Jump to content
Macro Express Forums

Repeat Sequence For An Amount Of Time?


archdude

Recommended Posts

Hello,

 

I've got a Macro where I need to repeat a part of it for let's say a variable of 20 minutes (1200 seconds) and then continue on to the next part of the macro.

 

For the life of me, I can't find anything on this.

 

Is this possible? If so, how can it be done?

 

Thanks!

Link to comment
Share on other sites

just make a loop UNTIL the target time

 

NOW

Time: Save hhmmss (150423) into %T5%

THEN (Target)

Time: Save hhmmss (150423) + 10 minutes into %T6%

Repeat Until %T5% > %T6%

// work code

Time: Save hhmmss (150423) into %T5%

Repeat End

 

 

The date/time function (under Text) has options for settting the time in relationship to "NOW" (and that can be prompted, and formats for time, cool)

Link to comment
Share on other sites

If the time exact time isn't hyper critical I will often just put a delay in my repeat loop and then vary the number of iterations. Or put some logical test within. So, say, repeat 120 times with a 10 second delay. In the end it will be a little more than 1200 seconds but often that isn't so important and it makes the macro a lot more simple.

Link to comment
Share on other sites

Thanks for the suggestions guys.

 

I was actually able to come up with the script to do what I wanted. My looping event was more than 1 second long so I could not get it acurate down to the second. This was fine with me, minute accuracy was no problem.

 

Here's what I came up with in case anyone's interested.

 

Please keep in mind, I'm not an advanced user, so I'm quite sure I've placed un needed steps in it, but it does what I need it to do.

 

Variables:

N1 - Current hour

N2 - Hours you need this to run (ex 2 would be to run for 2 hours)

N3 - Current hour inside the loop

 

N4 - Current Minute

N5 - Minutes you need this to run (ex 2 would be for 2 minutes)

N6 - Current minute inside the loop

 

 

Start of script:

 

Variable Set Integer %N1% from Current Hour

Variable Modify Integer %N2% = %N1% + (Hours that you need, must be a #)

If Variable %N2% > 23

Varibale Modify Integer %N2% = %N2% - 24 (adjustment for 24 hour clock)

End If

 

Variable Set Integer %N4% from Current Minute

Variable Modify Integer %N5% = %N4% + (Minutes that you need, must be a #)

If Variable %N5% > 59

Variable Modify Integer %N5% = %N5% - 60 (adjustment for 60 minute clock)

End If

 

Repeat Until %N5% = %N6%

Variable Set Integer %N6% from Current Minute (repeats for amount of minutes)

Repeat Until %N2% = %N3%

Variable Set Integer %N3% from Current Hour (repeats amount of hours)

 

This is where you put the things you need to be repeated

 

Repeat End

Repeat End

 

 

That's it, I hope this helps anyone that has a similar problem like my own.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...