Stop command ?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Gemster
Newbie
Posts: 1
Joined: Wed Nov 18, 2009 8:48 pm

Stop command ?

Post by Gemster » Wed Nov 18, 2009 10:35 pm

Hi im totaly new to macoing.

I have made a simple code but im stuck on a stop command.

Code: Select all


Label>start
my code here
my code here
my code here
GoTo>start

as you can see above i have the code repeat over and over. Thats what i want it to do but how can i stop it when i want to ?

like maybe press F8 and that will stop it from running ?

Thanks
Gemster

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

Post by JRL » Wed Nov 18, 2009 11:09 pm

There is a built in key combination to stop any Macro Scheduler macro. The key combunation is Shift + Esc. However, that is not always convenient because you might have more than one script running and you don't know which one will stop first. You can use the OnEvent> function to sense a key or key combination has been pressed and perform an action at the time of the key(s) being pressed. Stopping your macro would be one such action. To get a list of virtual key codes see the WaitKeyDown> function help. For more on OnEvent>, see OnEvent> help. OnEvent is really an extensive and useful function.

Here's your sample stopping with an F8 key press.

Code: Select all

//VK119=F8
OnEvent>Key_Down,VK119,0,STOP

SRT>STOP
  MDL>Stopping
  Exit>0
END>STOP


Label>start
  my code here
  my code here
  my code here
GoTo>start

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