I would like to execute a bat file only if a specific file exits. I have setup the follow macro:
IfFileExists>C:\test\runtest1.txt,merge
Goto>end
Label>merge
DeleteFile>C:\test\runtest1.txt
Run Program>C:\test\rats.bat
Label>end
I have test run it & it works fine. However, if I try to set it up on a RUN WHEN schedule M,T,W,T,F,S,S Starting at 6:00, repeat every 5 minutes, & repeat continuously, it never runs after the runtest1.txt file is built. What could I be doing wrong?
RunWhen Schedule
Moderators: Dorian (MJT support), JRL
Hi,
if you use a MSched version which provides to compile an exe, check this code - if not, don't waste time to read the following lines ...
OK, you've read it anyway. So, thx for your interest.
Ernest
if you use a MSched version which provides to compile an exe, check this code - if not, don't waste time to read the following lines ...
Code: Select all
Label>run
IfFileExists>C:\test\runtest1.txt,merge
Goto>WaitALittle
Label>merge
DeleteFile>C:\test\runtest1.txt
Run Program>C:\test\rats.bat
Label>WaitALittle
Wait>300
Goto>run
Ernest
RunWhen option
? You have to create a never-ending loop in the macro ? If you want to run it every 5 minutes or 5 hours it needs to be in a loop? What is the "repeat" time interval option for??
- Marcus Tettmar
- Site Admin
- Posts: 7386
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Hi,
You can do either. I think Ernest was just offering a standalone version which doesn't require scheduling and as such would work when compiled.
You can use the repeat option of the scheduler - set a start time and set the repeat interval to 5 minutes. Ensure you have version 7.1.12. There was an issue with 7.1.10 which stopped repeating schedules working. It was fixed in the next build.
You can do either. I think Ernest was just offering a standalone version which doesn't require scheduling and as such would work when compiled.
You can use the repeat option of the scheduler - set a start time and set the repeat interval to 5 minutes. Ensure you have version 7.1.12. There was an issue with 7.1.10 which stopped repeating schedules working. It was fixed in the next build.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Hi S#,
No you don't have to *.
There's a reason why I've pointed to the compiler release (which I don't own, therefore I don't know if a predefined scheduled script will be compiled 1:1 and runs the way you expect it). This script should run without any scheduling options.
I haven't identified any reason why your script isn't working with the RUN WHEN (Macro Properties) settings.
So this was an idea how to do it if you own the compiler release. And by the way - do you ?
300 sec are 5 min , so if you want to check for that file every five minutes, that's a damn loop look-a-like
Why not keeping the script alive!
I assume you don't have to shut down the PC for 4,54 min. inbetween
E.
*as my grandma said "the only thing you have to do is, to die - sometimes"
No you don't have to *.
There's a reason why I've pointed to the compiler release (which I don't own, therefore I don't know if a predefined scheduled script will be compiled 1:1 and runs the way you expect it). This script should run without any scheduling options.
I haven't identified any reason why your script isn't working with the RUN WHEN (Macro Properties) settings.
So this was an idea how to do it if you own the compiler release. And by the way - do you ?
300 sec are 5 min , so if you want to check for that file every five minutes, that's a damn loop look-a-like
Why not keeping the script alive!
I assume you don't have to shut down the PC for 4,54 min. inbetween
E.
*as my grandma said "the only thing you have to do is, to die - sometimes"