Loop Macro Running Wile the rest runs As well?

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
Joelyboy0991
Junior Coder
Posts: 24
Joined: Thu Oct 11, 2018 1:19 pm

Loop Macro Running Wile the rest runs As well?

Post by Joelyboy0991 » Thu Oct 25, 2018 2:44 pm

Hey all,
So in Engrish,

i have a macro that runs from start to finish and it has Goto> (loops)

i also want to have a loop that is simply running in its own *bubble*? lol so that the wait doesnt effect the timing of the rest of the macro or reverse.

Macro Aim:
-------------
Wait>15
Send>*Blahblah*
Repeat
--------------
But im having a issue working out which function i need to use to have it do that loop Whilst the rest runs
(without having to Run a separate .exe for a 3 line repeat macro)

i was looking into the On-event Function

OnEvent>Wait,15,0,jump
SRT>jump
Send>Space
END>jump

So every 15s since the macro started press Space (doesn't work of course)

I hope use understand what im aiming for

Much appreciated
n
cheers

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

Re: Loop Macro Running While the rest runs As well?

Post by JRL » Thu Oct 25, 2018 6:24 pm

Here's a sample using a Custom OnEvent>
Press Esc key to stop the script.

Code: Select all

//Cycle time in milliseconds
Let>vCycleTime=15000

Let>msg_xpos=300
Let>msg_ypos=300
Message>Cycle counts display here%crlf%every %vCycleTime% milliseconds

OnEvent>key_down,VK27,0,Quit
OnEvent>Custom,Source,vFlag,Target

Timer>vStart

Let>kk=0
Let>xPos=400
Let>yPos=400
Let>bump=1
Label>Loop
  Wait>0.01
  Add>xpos,bump
  Add>ypos,bump
  MouseMove>xpos,ypos
  If>xpos>420
    Let>bump=-1
  EndIf
  If>xpos<370
    Let>bump=1
  EndIf
Goto>Loop

SRT>Quit
  Exit>0
END>Quit

SRT>Source
  Timer>vEnd
  If>{%vEnd%-%vStart%>%vCycleTime%}
    Let>vStart=vEnd
    Let>vFlag=true
  EndIf
END>Source

SRT>Target
  Let>vFlag=
  Add>kk,1
  SetControlText>Macro Scheduler Message,TMemo,1,Cycle %kk%
END>Target

Joelyboy0991
Junior Coder
Posts: 24
Joined: Thu Oct 11, 2018 1:19 pm

Re: Loop Macro Running Wile the rest runs As well?

Post by Joelyboy0991 » Thu Oct 25, 2018 7:00 pm

Hi,

thanks for the reply..

Wow a lot more to it

ill read it over n test it out n
thank you for the help

only been using for couple weeks now and learned sooooo much!

Got some more questions coming i hope you guys will be able to understand :D.

also i am trying to go through every page on all of the Index Topics to find what i need before i ask.

Cheers

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