Hi,
I'd like to suggest the ability to programmatically assign schedule.
I mean two sides of this:
1. I'd like to be able to compile an exe and give it to my costomer and programmatically set the schedule for this program to be run.
2. And not less important - the way needed to programmatically check from inside the script (not compiled) what schedule it got.
Otherwise, for example, now my customers should set the schedule twice: once in the scheduler properties, and the second time in the script dialog so that I knew what schedule it got and act accordingly.
Could you please do it?
Thank you,
Olga.
Programmatically assign and access MSched script schedule
Moderators: JRL, Dorian (MJT support)
Hi,
1. Can already be done. You have time functions available to you so there is no reason why you can't programmatically check the time for the correct start time and run the rest of the script if it matches or keep checking the time if not.
The problem with this is that for this to work the .exe will have to be running ALL the time. Even if WE provided a function where schedule information could be included inside the .EXE without YOU having to write it it would STILL have to be running ALL the time. This is wasteful of resources and cumbersome when Windows already has an extremely good scheduler service included.
So, it can already be done, but we prefer to schedule targetted .exe files with the Windows Task Scheduler. It's more efficient and easy to do.
I'm assuming your point 2 is dependent on point 1 where it would check to see if the schedule was already set up. Again, there is no reason why you can't build a script that schedules itself and asks the user to set the schedule. It could also write a status flag to an INI file or in the registry or a .dat file or whatever when it runs so that it can also check to see if it run or if the schedule was set. In short, everything you ask here is possible and can be programmed with the script language. But, to reiterate, the big downside of a self-scheduling .exe file is the .exe file will need to run all the time and stay in memory. Since Windows Task Scheduler already exists why not use that?
1. Can already be done. You have time functions available to you so there is no reason why you can't programmatically check the time for the correct start time and run the rest of the script if it matches or keep checking the time if not.
The problem with this is that for this to work the .exe will have to be running ALL the time. Even if WE provided a function where schedule information could be included inside the .EXE without YOU having to write it it would STILL have to be running ALL the time. This is wasteful of resources and cumbersome when Windows already has an extremely good scheduler service included.
So, it can already be done, but we prefer to schedule targetted .exe files with the Windows Task Scheduler. It's more efficient and easy to do.
I'm assuming your point 2 is dependent on point 1 where it would check to see if the schedule was already set up. Again, there is no reason why you can't build a script that schedules itself and asks the user to set the schedule. It could also write a status flag to an INI file or in the registry or a .dat file or whatever when it runs so that it can also check to see if it run or if the schedule was set. In short, everything you ask here is possible and can be programmed with the script language. But, to reiterate, the big downside of a self-scheduling .exe file is the .exe file will need to run all the time and stay in memory. Since Windows Task Scheduler already exists why not use that?
MJT Net Support
[email protected]
[email protected]
Hi Marcus,
Thank you for your explanation.
The matter is that I don't want the program to run as a service or all the time, but I do want to know what schedule the user set for my script to run on (in Macro Scheduler).
In some cases (when for example, the script should run every 15 minutes), I can analyze when the script was running the previous time, and assume that it runs every 15 minutes, but what if the script is running Monday and Wednesday? Any assumption here would be wrong.
So, could there be a way to access the script schedule from the script itself?
And even better, the schedule of other scripts running with Macro Scheduler (lets suppose, I would know their names).
Thank you,
Olga.
Thank you for your explanation.
The matter is that I don't want the program to run as a service or all the time, but I do want to know what schedule the user set for my script to run on (in Macro Scheduler).
In some cases (when for example, the script should run every 15 minutes), I can analyze when the script was running the previous time, and assume that it runs every 15 minutes, but what if the script is running Monday and Wednesday? Any assumption here would be wrong.
So, could there be a way to access the script schedule from the script itself?
And even better, the schedule of other scripts running with Macro Scheduler (lets suppose, I would know their names).
Thank you,
Olga.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Can't you have the script use the logging, and parse out the strings that show when the macro was statrted?
If using Macro Scheduler, then you could possilbly use the macros.dat file to determine what schedules are assigned to what scripts. The program could make a copy of that file to some predefined location to keep as a reference.
If using Macro Scheduler, then you could possilbly use the macros.dat file to determine what schedules are assigned to what scripts. The program could make a copy of that file to some predefined location to keep as a reference.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!