Day Of The Week

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
new_guest

Day Of The Week

Post by new_guest » Wed Apr 14, 2004 11:45 am

Hello, can someone offer some insight into my problem?
My pseudo code is to accomplish the following:
If day_of_week = Monday then
variable = abc
If day_of_week = Tuesday then
variable = def
etc....

Is this possible without calling up some external ini/txt file? Or...?
Thanks in advance.

Lumumba

Post by Lumumba » Wed Apr 14, 2004 2:19 pm

If>day_of_week = Monday, DOWMon
If>day_of_week = Tuesday, DOWTue
.
.
.


Label>DOWMon
Let>var=abc
Goto, DOWDone

Label>DOWTue
Let>var=def
Goto, DOWDone
.
.
.

Label>DOWDone
MessageModal>%day_of_week% = %var%

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Apr 14, 2004 3:19 pm

If not already doing it, may I suggest using:
DayOfWeek>day_of_week
Then continue with lumumba's good script sample.
But I would remove the leading spaces before the labels from his quick and dirty sample.
If>day_of_week=Monday,DOWMon
If>day_of_week=Tuesday,DOWTue
...
...
Label>DOWMon
Let>var=abc
Goto>DOWDone

Label>DOWTue
Let>var=def
Goto>DOWDone
...
...
Label>DOWDone
MessageModal>variable for %day_of_week% = %var%
And finally, be sure to remove any trailing spaces from lines if doing a cut/paste from the forum samples.
Last edited by Bob Hansen on Wed Apr 14, 2004 8:34 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

new_guest

Post by new_guest » Wed Apr 14, 2004 5:24 pm

Thanks to the both of you for the help. However, in the code's present state, after all the If statements, the code runs through the first label and then jumps to the MessageModal at the end. The variable will always contain Monday's value. It appears that any code following labels are executed irregardless of If statements.

Any ideas? Thanks again.

Guest

Post by Guest » Wed Apr 14, 2004 5:39 pm

Also, it seems that day_of_week is not a system variable so all I get from

MessageModal>%day_of_week%

is a box that reads "%day_of_week%".

new_guest

Post by new_guest » Wed Apr 14, 2004 6:10 pm

Bob Hansen wrote:If not already doing it, may I suggest using:
DayOfWeek>day_of_week
....
Oops, sorry I forgot to add that part.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Apr 14, 2004 8:33 pm

Sorry, I think we have been trying to provide code snippets to give you a structure, a concept, and a headstart. Tough to write all the code for all requests.

Here is a more detailed structure with snippets. Perhaps it would be more helpful if it looked like this:
DayOfWeek>day_of_week

//Insert lines here for each day of week
If>%day_of_week%=Monday,DOWMon
If>%day_of_week%=Tuesday,DOWTue
...
...
If>%day_of_week%=Sunday,DOWSun

//Copy three lines below for each day of week, modifying Label and var value as necessary
Label>DOWMon
Let>var=abc
Goto>DOWDone

Label>DOWTue
Let>var=def
Goto>DOWDone
...
...
...
//Continue macro script from here
Label>DOWDone
MessageModal>variable for %day_of_week% = %var%
Also note that labels and variables are Case Sensitive.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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