If I am running a script, and once a day I need it to run another set of code within the script. How can I implement this? See attachment for the logic.
Thank you.
I am running a script in the macro scheduler... and need a daily time check
Moderators: JRL, Dorian (MJT support)
-
- Junior Coder
- Posts: 20
- Joined: Wed Jul 31, 2019 9:38 am
- Dorian (MJT support)
- Automation Wizard
- Posts: 1417
- Joined: Sun Nov 03, 2002 3:19 am
Re: I am running a script in the macro scheduler... and need a daily time check
Hi Diamondrail,
There's lots of ways of doing this. This is just one of them. It works with 0935 or 935. Whichever you choose.
For anyone wanting to use this method after 12pm, it uses the 24hr clock, so simply use 1335, 1435, and so on.
I included a small wait to avoid a tight loop :
There's lots of ways of doing this. This is just one of them. It works with 0935 or 935. Whichever you choose.
For anyone wanting to use this method after 12pm, it uses the 24hr clock, so simply use 1335, 1435, and so on.
I included a small wait to avoid a tight loop :
Code: Select all
Label>Start
Hour>TheHour
Min>TheMins
If>%TheHour%%TheMins%=935
MessageModal>Action script goes here
Else
Wait>1
Goto>Start
Endif
- Dorian (MJT support)
- Automation Wizard
- Posts: 1417
- Joined: Sun Nov 03, 2002 3:19 am
Re: I am running a script in the macro scheduler... and need a daily time check
How many other ways can our regular users think of to achieve this?
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: I am running a script in the macro scheduler... and need a daily time check
I do it like this:
Code: Select all
//Check loop
Label>StartOfLoop
Hour>HH
Min>MM
Sec>SS
GoSub>CheckClock,%HH%:%MM%:%SS%
Wait>0.25
Goto>StartOfLoop
SRT>CheckClock
If>CheckClock_Var_1=12:00:00
//Send to sub
Endif>
//Add more checks
END>CheckClock
Re: I am running a script in the macro scheduler... and need a daily time check
One more
Code: Select all
OnEvent>Time,0935,,RunDifferentLineOfCode
Label>RunLinesOfIrrelevantCode
Wait>1
Goto>RunLinesOfIrrelevantCode
SRT>RunDifferentLineOfCode
MDL>Its 9:35 am.%crlf%Now we wait a minute else we'd just keep running this Sub over and over until 9:36 am
Wait>61
END>RunDifferentLineOfCode
- Dorian (MJT support)
- Automation Wizard
- Posts: 1417
- Joined: Sun Nov 03, 2002 3:19 am
Re: I am running a script in the macro scheduler... and need a daily time check
Thank you for those.
It's always so nice to see how other people do things.
No matter how long we've been doing this we never seem to stop learning.
It's always so nice to see how other people do things.
No matter how long we've been doing this we never seem to stop learning.
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: I am running a script in the macro scheduler... and need a daily time check
What I like about my approach is that you can add as many checks as you want and also send day (number) of the week, month or whatever to have long time tasks triggered in the same mechanism.