Macro Scheduling Enhancements

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
bobd32
Newbie
Posts: 2
Joined: Wed Sep 06, 2006 3:37 pm
Location: Toronto, Ontario, Canada

Macro Scheduling Enhancements

Post by bobd32 » Thu Sep 07, 2006 5:05 pm

Provide ability to specify the following in macro schedules:

(1) First, Second, Third, Fourth, Last Day-Of-Week of the Month, for example, Third Friday of the Month.
(2) Add Last Day of the Month in addition to the numbers 1-31 when scheduling by day of the month.

Note for (1) and (2):
Although these kinds of specifications are also available in Windows Scheduled Tasks facility, it would be nice to also add them to Macro Scheduler for those situations where strict security standards forbid the use of Scheduled Tasks. Also, for the sake of consistency I would either user Macro Scheduler OR Task Scheduler to schedule tasks, not both. In my case, I'm forced to use only Macro Scheduler because of security restrictions on Task Scheduler.

(3) Add ability to specify statutory holidays so that macros can be scheduled run on business days only.
(4) Add ability to run a Scheduled Macro in the security context of a Domain Account.
(5) Add Last Run Column in Macro Display Window.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 13, 2006 10:29 pm

Hi,

You can already create such schedules:

E.g. to run a macro on third Friday of month, schedule the following macro to take place on Fridays:

Code: Select all

//Run on Nth whatever of month
Let>NthRequired=3
Day>d
Let>n={(%d% div 7)+1}
If>n=NthRequired
  Macro>YourMacro.scp
Endif
For different days, change the schedule for a different day and modify NthRequired as appropriate. E.g. for the second Wednesday, set NthRequired to 2 and schedule to take place on Wednesdays. Replace YourMacro.scp with the script file you want to run.

Here's another approach:
http://www.mjtnet.com/forum/viewtopic.php?t=1501

To run on the last day of the month use this:

Code: Select all

VBSTART
Function IsLastDayOfMonth
    If DateSerial(Year(Now), 1 + Month(Now), 0) = Date() Then
	  IsLastDayOfMonth = True
	Else
	  IsLastDayOfMonth = False
	End if
End Function
VBEND
VBEval>IsLastDayOfMonth,IsIt
If>IsIt=True
...
...
Endif
Or see:
http://www.mjtnet.com/forum/viewtopic.php?t=1508

For statutory holidays, create a text file containing all dates that represent holidays. At start of macro look to see if today's date exists in file and if so, don't run.

Here's a function you can use to determine if today is the last working day of the month (assuming work days are Mon thru Fri):

Code: Select all

//Is Last Working Day of Month
//Assumes Work Days are Mon to Fri
VBSTART
Function IsLastWorkDayOfMonth
   IsLastWorkDayOfMonth = False
   ThisMonth = Month(Now)
   'what day is it (1 = Sunday)
   d = WeekDay(Now)
   'if mon-thu add one to date 
   if d < 6 then
   	  offset = 1
   end if
   'if Friday, then offset is 3 
   if d = 6 then
   	  offset = 3
   end if
   NextWorkDay = Date + offset
   NextWorkDayMonth = Month(NextWorkDay)
   if NextWorkDayMonth > ThisMonth then
	  IsLastWorkDayofMonth = True
   End if
End Function
VBEND
VBEval>IsLastWorkDayOfMonth,IsIt
Clearly you can combine these with your holiday text file lookup if needed.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts