OnEvent Can someone tell me what im doing wrong

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

OnEvent Can someone tell me what im doing wrong

Post by Aaron » Mon May 21, 2007 1:36 am

Can someone tell me what im doing wrong

Code: Select all

wait>0.2
   OnEvent>KEY_DOWN=VK_LBUTTON,0,LEFT
   OnEvent>KEY_DOWN=VK_RBUTTON,0,RIGHT

Label>MainLoop
 Wait>0.2

SRT>LEFT
MessageModal>you pressed the Left mouse button
End>LEFT

SRT>RIGHT
MessageModal>KeyPress=you pressed Right mouse button
End>RIGHT

Goto>MainLoop
Aaron

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon May 21, 2007 4:52 am

Aaron,
Your onevent statement is incorrect. Replace the equals sign with a comma and replace the key assignment text with the virtual code and this should work for you. See help for onevent for more info.

I also took the liberty of moving your subroutines out of your loop. They would work the way you had it but in complex scripts the extra code inside the loop might get confusing.

Code: Select all

Try this instead.
   OnEvent>KEY_DOWN,VK01,0,LEFT
   OnEvent>KEY_DOWN,VK02,0,RIGHT

Label>MainLoop
 Wait>0.2
Goto>MainLoop

SRT>LEFT
MessageModal>you pressed the Left mouse button
End>LEFT

SRT>RIGHT
MessageModal>KeyPress=you pressed Right mouse button
End>RIGHT

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Thank you JRL

Post by Aaron » Mon May 21, 2007 5:48 am

Thank you JRL

I guess I got mixed up while doing research on this project.

I think I mixed in some visual basics.net or javascript.
Aaron

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts