Maybe a branch question???

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
danno111
Newbie
Posts: 4
Joined: Tue Mar 15, 2011 7:00 pm

Maybe a branch question???

Post by danno111 » Sun Apr 24, 2011 9:35 pm

Total newb here.

I have a scrip that is about 1200 lines long. It runs perfectly and when it's done, I have to make a simple click to take me to a new location and then run the same exact 1200 line script again. I have to do this 12 times.

These interim clicks are in different locations, so I can't just loop the script. I could probably have one giant script that includes the interim clicks, but I assume there is a better way.

What should I do to run my script and then read from another macro which will give the location changing click and then go back to the original, and so on until it has run all 12 times? I hope this makes sense.

Thank you very much.

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Mon Apr 25, 2011 2:11 pm

Can you have the 2nd macro you mention, write the location to a file?
(Passing either screen coordinates or window name/handle, etc.)

Then when the big script is done, read file for next location.
Thanks,
Jerry

[email protected]

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

Post by JRL » Mon Apr 25, 2011 6:58 pm

Place your script in the space provided and see if this works for you. You should be able to loop through your script as many times as needed. I don't know what you want to do to end the script. Perhaps add a counter if you have a specific number of points to select. Or perhaps use the Ask> function each loop and ask if you are finished.

Code: Select all

Let>ScriptIsRunningFlag=0

OnEvent>Key_down,VK1,0,SetScriptIsRunningFlag

SRT>SetScriptIsRunningFlag
  If>ScriptIsRunningFlag=0
    Let>ScriptIsRunningFlag=1
  EndIf
END>SetScriptIsRunningFlag


Label>WaitingForMouseClick
  Wait>0.01
  If>ScriptIsRunningFlag=1
    Goto>StartScript
  EndIf
Goto>WaitingForMouseClick

Label>StartScript
  /////////////////////////Start 1200 line working script


  ///////    Your script here   ///////
  
  
  /////////////////////////End 1200 line working script

  Let>ScriptIsRunningFlag=0
Goto>WaitingForMouseClick

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