Jump to content
Macro Express Forums

How to set this semi-anuual schedule?


Recommended Posts

Hi,

 

Literally, in a non-MEP context, I wish, I will be reminded by my wife every semi-annually to backup my HDD drives starting from the coming September this year. I might be lazy or could be busy by the time I am reminded by her, however I can be sure if she keep reminding me every evening (say at 9.00 P.M.) .I will have that backup done within a week. Unfortunately my wife is as forgetful as I am and I don't think she has the stamina to keep reminding me on the same thing sharply at 9.00 P.M. for 7 days. So, I hope MEP can come to help...

 

I want to create this macro once and for all... but I am lack of idea how to actually schedule my macro in the most efficient way.

 

1) I want MEP to pop me a reminder to backup my HDD drives (I will do that with Disk Image utility). -> this part I have no problem to do it myself.

 

2) I want the reminder to appear every day but only in the month of March and September at 9.00 PM for their first 7 days (i.e. day 1 to day 7 of these 2 months)

 

3) The reminder stops for the month being, as soon as I change a file 'HDD BACKUP.RMD' on my C: drive such that the year and month of its date match the date as in 2) and it then waits to remind me again 6 months later.

 

4) This macro repeats until I die.

 

So, how do I schedule the above ? What is the best way to minimize the MEP checks on whether it needs to remind me?

Edited by t.s.lim
Link to comment
Share on other sites

Questions:

1) What operaing system do you run?

2) Do you cause your computer to reboot each day? By this I mean you don't hibernate or standby your machine, or have it on all the time. What I want to find out is whether you start Macro Express each day, or whether it's already running when you start up each day (e.g. because the machine wakes from hibernation).

 

Depending on your answers, a good solution might be to have a startup macro that runs each day which handles all the logic needed to achieve your aim.

Link to comment
Share on other sites

Questions:

1) What operaing system do you run?

2) Do you cause your computer to reboot each day? By this I mean you don't hibernate or standby your machine, or have it on all the time. What I want to find out is whether you start Macro Express each day, or whether it's already running when you start up each day (e.g. because the machine wakes from hibernation).

 

Depending on your answers, a good solution might be to have a startup macro that runs each day which handles all the logic needed to achieve your aim.

 

I am using Windows Xp.

 

 

I never t let my PC goes hibernate nor standby, I normally shut down my PC before I go to sleep, however, sometime I will keep it running for a few days.

 

 

 

 

 

Link to comment
Share on other sites

I'm slightly confused by your points 2 and 3:

2) I want the reminder to appear every day but only in the month of May and September at 9.00 PM for their first 7 days (i.e. day 1 to day 7 of these 2 months)

 

3) The reminder stops for the month being, as soon as I change a file 'HDD BACKUP.RMD' on my C: drive such that the year and month of its date match the date as in 2) and it then waits to remind me again 6 months later.

Does this macro run only for the first 7 days of May and September at 9pm, or does it run until the specified file has a current date?

 

Also, May and September are not 6 months apart!

 

And the macro will not be able to determine when you die, either in advance or after the event :( !

Link to comment
Share on other sites

I'm slightly confused by your points 2 and 3:

 

Does this macro run only for the first 7 days of May and September at 9pm, or does it run until the specified file has a current date?

 

Also, May and September are not 6 months apart!

 

Sorry, that should be March not May. The macro should run for the first 7 days at 9.00 pm provided the mentioned file is absent or its date is not current. 

 

 

 

 

 

And the macro will not be able to determine when you die, either in advance or after the event  :( !

 

 

 

 

I mean it runs "indefinitely". 

 

 

if I die, I won't be able to know whether it is still running, I assume no one will use (thus switch ON my PC), so, that macro should stop indefinitely by then. :)

 

 

Link to comment
Share on other sites

Below is the outline of a macro that should solve your problem. I have assumed you know MEP sufficiently well to turn it into real code.

 

This macro is activated via ME's scheduler:

- Schedule it to run each day at 9pm

- Tick the box "If the activation was missed, run at the next available time" (if the computer is off at the appointed time, when you next turn on the computer, the macro should run)

 

Macro Outline

- Get today's date in a text variable using format mm (tMonth)

- If tMonth is neither 03 nor 09, exit the macro (note the leading zero as we are dealing with a text variable)

- Get today's date in a text variable using format dd (tDay)

- If tDay is more than 07, exit the macro (note the leading zero as we are dealing with a text variable)

- Get today's date in a text variable using format yyyy (tYear)

- Convert tYear to integer (nYear)

- Get today's date in a text variable using format mm (tMonth)

- Convert tMonth to integer (nMonth)

- Get the file's Modified Date/Time Month and Year only (nFMonth and nFYear)

- If nYear equals nFYear AND tMonth equals nFMonth, exit the macro

- Display your reminder message

 

Notes

- I have kept this macro simple so that it does only one thing at a time (for example, we could have retrieved Today's Date only once and then extracted the various substrings needed).

- Names in parentheses simply identify specific variables used in the following line, where the first letter of the name identifies its type, e.g. t for text, n for integer.

- This macro will run each and every day, and takes an imperceptible amount of time to run, even when it displays its reminder message (only on 14 days each year).

- If the computer is not switched on at 9pm, this macro will not run: instead, it will run when you next start Macro Express. We could make this more sophisticated and have it turn on your machine at 9pm each day, but that would involve using the Windows scheduler; however, if your computer is off at 9pm on the 7th of March or the 7th of September and you don't turn your computer back on until the next day, this macro will not display any reminder for another 6 months.

- You can make your message as bright and loud as you like by using colours, fonts, etc.

Link to comment
Share on other sites

Below is the outline of a macro that should solve your problem. I have assumed you know MEP sufficiently well to turn it into real code.

 

This macro is activated via ME's scheduler:

- Schedule it to run each day at 9pm

- Tick the box "If the activation was missed, run at the next available time" (if the computer is off at the appointed time, when you next turn on the computer, the macro should run)

 

Macro Outline

- Get today's date in a text variable using format mm (tMonth)

- If tMonth is neither 03 nor 09, exit the macro (note the leading zero as we are dealing with a text variable)

- Get today's date in a text variable using format dd (tDay)

- If tDay is more than 07, exit the macro (note the leading zero as we are dealing with a text variable)

- Get today's date in a text variable using format yyyy (tYear)

- Convert tYear to integer (nYear)

- Get today's date in a text variable using format mm (tMonth)

- Convert tMonth to integer (nMonth)

- Get the file's Modified Date/Time Month and Year only (nFMonth and nFYear)

- If nYear equals nFYear AND tMonth equals nFMonth, exit the macro

- Display your reminder message

 

Notes

- I have kept this macro simple so that it does only one thing at a time (for example, we could have retrieved Today's Date only once and then extracted the various substrings needed).

- Names in parentheses simply identify specific variables used in the following line, where the first letter of the name identifies its type, e.g. t for text, n for integer.

- This macro will run each and every day, and takes an imperceptible amount of time to run, even when it displays its reminder message (only on 14 days each year).

- If the computer is not switched on at 9pm, this macro will not run: instead, it will run when you next start Macro Express. We could make this more sophisticated and have it turn on your machine at 9pm each day, but that would involve using the Windows scheduler; however, if your computer is off at 9pm on the 7th of March or the 7th of September and you don't turn your computer back on until the next day, this macro will not display any reminder for another 6 months.

- You can make your message as bright and loud as you like by using colours, fonts, etc.

 

Thanks for the guideline.

 

I somehow feel that there is still very big room for improvement in Macro Express's schedule feature. Use your guideline as example, the first two 'If'' are suppose to be in the 'Activation' portion of a macro, there should be a single 'if' (i.e. condition) checking - against the file date in codes.

 

If MEP provides pick Sunday ... Saturday of a week, why not add also, pick 1-24 hours of a day and pick Jan - Dec of a year?

 

If MEP can provide Run a macro from time X to time Y in a day, why not include also, from day X to day Y of a week and from month X to month Y of a year.

 

All these shall save a lot of coding if one has quite a number of scheduled macro that required any of them.

 

 

 

 

 

Link to comment
Share on other sites

I somehow feel that there is still very big room for improvement in Macro Express's schedule feature. Use your guideline as example, the first two 'If'' are suppose to be in the 'Activation' portion of a macro, there should be a single 'if' (i.e. condition) checking - against the file date in codes.

 

If MEP provides pick Sunday ... Saturday of a week, why not add also, pick 1-24 hours of a day and pick Jan - Dec of a year?

 

If MEP can provide Run a macro from time X to time Y in a day, why not include also, from day X to day Y of a week and from month X to month Y of a year.

 

All these shall save a lot of coding if one has quite a number of scheduled macro that required any of them.

You can always use Windows' bult-in scheduler (which is far more sophisticated than MEP's) to fire off macros. I'll leave you to take a look at all the things you can do with the Windows scheduler - the command line you require is:

"x:\Macro Express Pro\meproc.exe" /AMyMacro

where:

- x: is the fully qualified name of your Programs folder, e.g. C:\Program Files, C:\Program Files (x86)

- MyMacro is the macro name of the macro you wish to run

 

Of course, you won't need to include in your macro any of the date stuff, though you will still have to compare the file year and month with today's year and month.

Link to comment
Share on other sites

You can always use Windows' bult-in scheduler (which is far more sophisticated than MEP's) to fire off macros. I'll leave you to take a look at all the things you can do with the Windows scheduler - the command line you require is:

"x:\Macro Express Pro\meproc.exe" /AMyMacro

where:

- x: is the fully qualified name of your Programs folder, e.g. C:\Program Files, C:\Program Files (x86)

- MyMacro is the macro name of the macro you wish to run

 

Of course, you won't need to include in your macro any of the date stuff, though you will still have to compare the file year and month with today's year and month.

 

But Windows' bult-in scheduler can't set any condition which is not time/date related, right?

 

Since I am running MEP all the time, I don't find it a good idea to run more than one scheduler programs...

 

 

Link to comment
Share on other sites

But Windows' bult-in scheduler can't set any condition which is not time/date related, right?

 

Since I am running MEP all the time, I don't find it a good idea to run more than one scheduler programs...

I disagree with you about what I expect of a scheduler. IMHO, a scheduler should be able to schedule programs according to various date/time criteria. Once you start examining specific files for their dates and times, you should be processing that logic in a user-written program.

 

The Windows scheduler is much more sophiticated and powerful than MEP's, and includes the ability to turn on a sleeping computer.

Link to comment
Share on other sites

The Windows scheduler is much more sophiticated and powerful than MEP's, and includes the ability to turn on a sleeping computer.

 

That can be true if you are comparing it to just MEP's activation Schedule feature. If you consider the codes in a macro of MEP, then I don't see anything else (besides your turn on sleeping computer) that can be done by Window Scheduler but a MEP macro.

 

 

What I am requesting is to make MEP's activation Schedule feature richer in its options, make it even better than general scheduler program (including Window's native scheduler), that shall save repeated scheduling codes in macros.

 

 

Link to comment
Share on other sites

That can be true if you are comparing it to just MEP's activation Schedule feature. If you consider the codes in a macro of MEP, then I don't see anything else (besides your turn on sleeping computer) that can be done by Window Scheduler but a MEP macro.

Really? Have you looked at the Windows (7) Scheduler? You can schedule tasks to run even when the user isn't logged on (try that with MEP and see what happens :rolleyes: ), there's a plethora of events you can use, etc., etc. As I said, it's far more powerful than MEP's, but, for the most part, I think MEP's scheduler is adequate for its purpose.

Link to comment
Share on other sites

That can be true if you are comparing it to just MEP's activation Schedule feature. If you consider the codes in a macro of MEP, then I don't see anything else (besides your turn on sleeping computer) that can be done by Window Scheduler but a MEP macro.

I humbly disagree. There are many scheduling capabilities Windows has over MEP. One of the big ones is that MEP only checks to see if a scheduled event should execute at a fixed and rather coarse frequency. This means things don’t execute exactly when you want. Of course in most cases that’s not important but recently we had a forum member who it was a problem for. And if you want down-to-the-second scheduling MEP can’t do it but in the Windows Task Scheduler I can set something to execute at 9:47:30PM. You can schedule a task even if the computer is hibernating. Any combination of months, really good for quarterly tasks and you really need to look at that one. The only thing I can think of is that maybe you don’t have some of these in XP? If I remember correctly second level resolution wasn’t available in XP. But if ones set on running a decade old OS then one must live with the limitations.

Link to comment
Share on other sites

What I am requesting is to make MEP's activation Schedule feature richer in its options, make it even better than general scheduler program (including Window's native scheduler), that shall save repeated scheduling codes in macros.

If you have a feature request I highly suggest you read the forum sticky on “Reporting bugs and requesting features”. I know, stickies are boring but... And I do agree that it would be nice to have more scheduling options in MEP. The Windows Task Scheduler is great but if I have to distribute my macro that’s not an appealing option.

Link to comment
Share on other sites

Really? Have you looked at the Windows (7) Scheduler? You can schedule tasks to run even when the user isn't logged on (try that with MEP and see what happens :rolleyes: ), there's a plethora of events you can use, etc., etc. As I said, it's far more powerful than MEP's, but, for the most part, I think MEP's scheduler is adequate for its purpose.

 

Strictly speaking, I don't consider what you have mentioned as "powerful" scheduling ability. It is just a matter of what a "window service" can do while an ordinary window program can NOT. MEP is a window program which runs only after Windows is up running as usual, you can't expect it to do anything for you while it is not even running... It is just like, you can't claim that a magic wizard is more powerful than an ordinary doctor for a doctor can't ressurect a dead. (he can't because that is not in his job scope)

 

Just for your info, Windows service, including your most admired Windows scheduler required a login (otherwise it forfeits Windows security requirement), though you can make the login implicit (in a layman term an auto or unattended login). There is, for example, backup program that uses a service to login (MS Server 2008) and carry out backup job event before any user has login. (But you have to specify a user name and password to let it run under the user account). If your Win7's scheduler really let something occurs even without needing anyone to login, don't be happy yet, think about security,,, think it hard, do you really want that?

 

 

 

 

 

 

Link to comment
Share on other sites

Speaking of Windows Scheduler, I would like to share with you my recent experience of its power...

 

My Windows XP HDD has started to develop "bad sector" just few days ago. I am lucky that I have 3 logical drives on that HDD and bad sector has not developed in C: drive where my Windows XP resites (that is why I can still boot up my Windows)

 

I actually confirm on its problem when I try to create an image backup using Norton Ghost (and I was warned about bad sector) that immediately explains to me why one of my Steam game keep having corrupted game files and required me to reload.

 

My plan is to brute-force a backup using Norton Ghost's -FRO -SURE switches then restore the my Windows XP to a new replacement.HDD. But before that I try to chkdsk /r on the logical drive where my Steam game resites (I hope it will reallocate as much as possible, data from the bad sector area before I backup). Almost as it always will, I was prompted to schedule the check because Chkdsk needs absolute access right while doing its task, I answer 'Yes' (so scheduled the HDD chkdsk... see what happen next)

 

Upon rebooting my WinXP, I notice my HDD indicator blinking intensively (chkdsk is working hard to find and reallocate bad sector data, I know it), and then wtfck, I got a blue screen with error: "c000021a unknow Hard error". i.e. chkdsk /r has triggered a blue screen ... the funny thing is, if I reboot my PC after seeing the blue screen, the same event sequence repeats (reboot-> Chkdsk/r -> blue screen),

 

My Goodness...I now can't even boot up my WinXP because Windows has scheduled to complete chkdsk/r on its next boot up, but that task can never be completed without triggering a blue screen in the mid. So, now what? Why me? $^$*638^%&$^#^ ...

 

Since I am posting in this forum again, as of this writing, sure, I have the above solved. But "how I solved the above" is not my intention of this message. My point is why can't Window scheduler just switch off the chkdsk /r task after it fails to complete in its very first try? Window scheduler is not that POWERFUL, right?

 

 

Link to comment
Share on other sites

Speaking of Windows Scheduler, I would like to share with you my recent experience of its power...

 

My Windows XP HDD has started to develop "bad sector" just few days ago. I am lucky that I have 3 logical drives on that HDD and bad sector has not developed in C: drive where my Windows XP resites (that is why I can still boot up my Windows)

 

I actually confirm on its problem when I try to create an image backup using Norton Ghost (and I was warned about bad sector) that immediately explains to me why one of my Steam game keep having corrupted game files and required me to reload.

 

My plan is to brute-force a backup using Norton Ghost's -FRO -SURE switches then restore the my Windows XP to a new replacement.HDD. But before that I try to chkdsk /r on the logical drive where my Steam game resites (I hope it will reallocate as much as possible, data from the bad sector area before I backup). Almost as it always will, I was prompted to schedule the check because Chkdsk needs absolute access right while doing its task, I answer 'Yes' (so scheduled the HDD chkdsk... see what happen next)

 

Upon rebooting my WinXP, I notice my HDD indicator blinking intensively (chkdsk is working hard to find and reallocate bad sector data, I know it), and then wtfck, I got a blue screen with error: "c000021a unknow Hard error". i.e. chkdsk /r has triggered a blue screen ... the funny thing is, if I reboot my PC after seeing the blue screen, the same event sequence repeats (reboot-> Chkdsk/r -> blue screen),

 

My Goodness...I now can't even boot up my WinXP because Windows has scheduled to complete chkdsk/r on its next boot up, but that task can never be completed without triggering a blue screen in the mid. So, now what? Why me? $^$*638^%&$^#^ ...

 

Since I am posting in this forum again, as of this writing, sure, I have the above solved. But "how I solved the above" is not my intention of this message. My point is why can't Window scheduler just switch off the chkdsk /r task after it fails to complete in its very first try? Window scheduler is not that POWERFUL, right?

 

I think you are being a bit unfair on Windows Scheduler there though. If you read the following link it explains how chkdsk is fired up on startup.

 

Microsoft Support

Link to comment
Share on other sites

I think you are being a bit unfair on Windows Scheduler there though. If you read the following link it explains how chkdsk is fired up on startup.

 

Microsoft Support

 

I admit I have assumed it is a Window Schedule that fires up chkdsk /r and I have not searched on-line for the fact what indeed was going on behind that.

 

But isn't it funny that when I boot WinXP up under safe mode and issue a "schtasks /delete *" command, it stops the blue screen (as mentioned in my previous post) and I can boot normally into Windows from there on?

Btw, thanks for the link to explain how chkdsk is scheduled... again I presume MS couldn't be wrong in explaining how their products work. .. um... to be fair, that link really supports what I have claimed, even MS thenselve can't scheduled chkdsk with Window Scheduler, so it is not that POWERFUL.

 

 

 

 

 

Link to comment
Share on other sites

My point is why can't Window scheduler just switch off the chkdsk /r task after it fails to complete in its very first try? Window scheduler is not that POWERFUL, right?

I don't think you understand how a scheduler works.

 

A scheduler is designed to initiate a specified task at its first appointed time, then reschedule the task so that it will be able to run at its next appointed time, if relevant. Once the task has been started [and rescheduled], the scheduler has completed its job. It does not hang around, waiting for the task to complete and report back its success or failure.

 

Once you understand that, then you can see that a task is therefore either to run once only, or to run repeatedly at various intervals. If the task is to run once, then that task's next run time is Never. In the case of Windows startup tasks, they are presumably scheduled to run each time Windows boots, and it is the task's responsibility to "delete" itself when it has run successfully. In your particular case, the job failed and so remained to be run again next time Windows was restarted.

 

And if you think about that strategy for a moment, then you will see that the key requirement for the chkdsk task was to complete successfully, because until that happened, there was no guarantee that your disks were in good order. In the circumstances you describe, you really have no idea what state your disks are in because of that recurring BSOD. For the continued health of your system I really think you need to get to the bottom of that issue and resolve it properly.

Link to comment
Share on other sites

I don't think you understand how a scheduler works.

 

 

 

I think I do.

 

 

A scheduler is designed to initiate a specified task at its first appointed time, then reschedule the task so that it will be able to run at its next appointed time, if relevant. Once the task has been started [and rescheduled], the scheduler has completed its job. It does not hang around, waiting for the task to complete and report back its success or failure.

 

 

 

My definition is simpler, anything I plan to do at certain time is considered being scheduled.

 

 

 

Once you understand that, then you can see that a task is therefore either to run once only, or to run repeatedly at various intervals. If the task is to run once, then that task's next run time is Never. In the case of Windows startup tasks, they are presumably scheduled to run each time Windows boots, and it is the task's responsibility to "delete" itself when it has run successfully. In your particular case, the job failed and so remained to be run again next time Windows was restarted.

 

In fact I am aware that a bit is set in boot sector to summon chkdsk when Windows bootup simply because Norton Ghost prompt me about that (bit 446) while I attempt to create a backup image of my HDD.

 

My wrong assumption is "what" launch the chkdsk program (after detecting the marked bit), I assume it is Windows Scheduler and I was wrong! Don't blamed me, I have been bombard with the "power" of Windows Scheduler all this while...

 

 

 

 

 

 

And if you think about that strategy for a moment, then you will see that the key requirement for the chkdsk task was to complete successfully, because until that happened, there was no guarantee that your disks were in good order. In the circumstances you describe, you really have no idea what state your disks are in because of that recurring BSOD. For the continued health of your system I really think you need to get to the bottom of that issue and resolve it properly.

 

If you read again my previous post, you should notice 2 things:

 

1. I am aware of bad sectors (start to develop) on my WinXP HDD before I scheduled a chkdsk /r

 

2. I don't expect chkdsk to clear the bad sectors for me (since that is impossible), I only want it to reallocate as much good data from the bad sector area to healthy spots on that HDD.

 

From 2. you should see that, sometime, the purpose of running chkdsk could mean to cut down losses instead of cure a storage problem absolutely. If you agree with me on this point, then you should agree also, if chkdsk /r always fails with the same cause then blindly repeating it is simply UNWISE.

 

Just imagine if MEP is being used to launch chkdsk /r, it is easy to code such that it won't foolishly repeat the launch indefinitrly, right? The same thing can't be done (and is currently NOT done) by Windows Scheduler.

 

Hence, generally spesking, MEP is better than Windows Scheduler in launching anything. The claim that the latter is more powerful could not be TRUE,

 

 

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Forgive me if someone has already suggested this but I’m too busy to go back and re-read this entire thread. But I remembered an old trick I used to use in cases like this.

 

Instead of creating multiple macros and other such inelegant (IMHO) solutions there it one method that’s slightly more elegant though admittedly not ideal. Fire on a more granular frequency and add logic to exclude certain occurrences. For instance if you have a quarterly tax payments in the US they go on a bizarre quasi-quarterly frequency: 1/12, 4/12, 6/12, and 9/12. So what you do it create a scheduled activation for the 12th of each month and then when it first the first thing you do is extract the month number from the current date and if it is not in the set of 1,4,6, or 9 then abort.

 

Still not ideal but personally I like this method better because I’d like to minimize the number of macros in my file and I like the notion that one macro represents one macro instead of multiple macros representing one.

Link to comment
Share on other sites

Hi Cory,

 

Thanks for you input.

 

For what I want to achieve (as in the very first post of this thread), In fact I am currently using a macro similar to what you have suggested.

 

MEP really have to improve its scheduling features to make it more flexible (and thus covers more cases). FYI, I am among those few that keep pressing Insight since ME3 (backtrace to year 2002) for the ability to schedule a macro run once and only once but not at a particular point of time which ends up as the MEP's "If the activation was missed, run at the next available time" feature.

 

I strongly believe my suggestion on how to enhance the MEP schedule feature in the other thread, if implemented will make MEP much more powerful.

 

 

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...