archdude Posted August 21, 2007 Report Share Posted August 21, 2007 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! Quote Link to comment Share on other sites More sharing options...
archdude Posted August 21, 2007 Author Report Share Posted August 21, 2007 Hey Guys, I think I have a solution, but it's turning out to be more complicated than I originally thought. I've found some stuff that I needed for it, and I'm working on a solution to my problem. I'll post if I can get it to work. Quote Link to comment Share on other sites More sharing options...
mcZenner Posted August 21, 2007 Report Share Posted August 21, 2007 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) Quote Link to comment Share on other sites More sharing options...
Cory Posted August 22, 2007 Report Share Posted August 22, 2007 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. Quote Link to comment Share on other sites More sharing options...
archdude Posted August 27, 2007 Author Report Share Posted August 27, 2007 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. Quote Link to comment Share on other sites More sharing options...
blopib Posted August 27, 2007 Report Share Posted August 27, 2007 Hi Archdude Just as a tip. I think you could also have used Pauls suggestion from the post: Using Time In An If Statement, Is this even possible? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.