First off, when you say "Right Trigger",do you mean an XBOX joypad?
If so, bear in mind that UJR or AHK's normal joystick support cannot detect the right trigger independently of the left trigger on an XBOX pad.
To do that, you would need Lexikos' XInput library.
So you want to convert that script to be activated by the joystick Z axis of your joystick?
You need to know the ID of your stick. If you have vjoy installed, it will not be 1
Assuming your stick with the right trigger on it is ID 2, the code would be:
GetKeyState, TriggerState, 2JoyZ
if (TriggerState > 60) ; you may need to change this to < 40 if left trigger activates instead
VJoy_SetBtn(1, 1, 3)
VJoy_SetBtn(0, 1, 3)