I am having a bit of trouble. Have a look at this code and look below to see my problem:

Code:
'What this code is supposed to do is
'simulate the mouse using the joypad
'or joystick.

Dim joypos As JOYINFO

joyGetPos 0, joypos

lblJoystickXPos.Caption = "X Position: " & joypos.wXpos
lblJoystickYPos.Caption = "Y Position: " & joypos.wYpos
lblJoystickZPos.Caption = "Z Position: " & joypos.wZpos

If (joypos.wButtons And JOY_BUTTON1) = JOY_BUTTON1 Then
 mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If

If (joypos.wButtons And JOY_BUTTON2) = JOY_BUTTON2 Then
 mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
 mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End If

'The mouse movement code goes
'here, but I won't include it
'because it takes up to much
'room.
This is repeated every millisecond by a timer. It has to be updated often so the positions can be read by the user. The 'If' statements are for when you push a button on the joystick. But the thing is, for every millisecond you hold down the joystick button, it clicks!

I need to find out a way to stop it from clicking every milliseconds, without changing the script too much.