DoW> Command
Moderators: JRL, Dorian (MJT support)
DoW> Command
Is it possible to have a cDOW> command to generate a character string for the day of week? Thanks.
Armstrong Wong
Armstrong Wong
Hi,
Here's a MacroScript subroutine to do it:
SRT>DayOfWeek
Let>DayArray[1]=Sunday
Let>DayArray[2]=Monday
Let>DayArray[3]=Tuesday
Let>DayArray[4]=Wednesday
Let>DayArray[5]=Thursday
Let>DayArray[6]=Friday
Let>DayArray[7]=Saturday
DayOfWeek>day
Let>DayString=DayArray[%day%]
END>DayOfWeek
Call DayOfWeek and then the value DayString will contain the name of the day. E.g.:
GoSub>DayOfWeek
MessageModal>DayString
And here's another way to do it using VBScript:
VBSTART
Function cDOW
cDOW = WeekdayName(WeekDay(Now))
End Function
VBEND
VBEval>cDOW,vbDayString
Here's a MacroScript subroutine to do it:
SRT>DayOfWeek
Let>DayArray[1]=Sunday
Let>DayArray[2]=Monday
Let>DayArray[3]=Tuesday
Let>DayArray[4]=Wednesday
Let>DayArray[5]=Thursday
Let>DayArray[6]=Friday
Let>DayArray[7]=Saturday
DayOfWeek>day
Let>DayString=DayArray[%day%]
END>DayOfWeek
Call DayOfWeek and then the value DayString will contain the name of the day. E.g.:
GoSub>DayOfWeek
MessageModal>DayString
And here's another way to do it using VBScript:
VBSTART
Function cDOW
cDOW = WeekdayName(WeekDay(Now))
End Function
VBEND
VBEval>cDOW,vbDayString
VBScript Error
Hi,
I try your VBScript:
VBSTART
Function cDOW
cDOW = WeekdayName(WeekDay(Now))
End Function
VBEND
VBEval>cDOW,vbDayString
but encounter Macro Scheduler Error:
Microsoft VBScript compilation error: 1002
Syntax error
Line 6, Column 6
Please help. Thanks.
Armstrong Wong
I try your VBScript:
VBSTART
Function cDOW
cDOW = WeekdayName(WeekDay(Now))
End Function
VBEND
VBEval>cDOW,vbDayString
but encounter Macro Scheduler Error:
Microsoft VBScript compilation error: 1002
Syntax error
Line 6, Column 6
Please help. Thanks.
Armstrong Wong
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
The problem appears to be spaces or control characters at the end of the lines. When you copy and paste from a web page you will end up with invisible characters at the end of each line which VB/Macro Scheduler doesn't like. Either type manually, or go to the end of each line and hit the Del key.
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?
cDoW
Bingo! The VBscrip works perfectly:
VBSTART
Function cDOW
cDOW = WeekdayName(WeekDay(Now))
End Function
VBEND
VBEval>cDOW,vbDayString
Mid>vbDayString,1,3,vbDayString
GetDate>Date
GetTime>Time
Sen>%Date% %vbDayString% %Time%
Marcus, thanks a lot. I hope more built-in functions will be included in the Macro Scheduler.
Armstrong Wong
VBSTART
Function cDOW
cDOW = WeekdayName(WeekDay(Now))
End Function
VBEND
VBEval>cDOW,vbDayString
Mid>vbDayString,1,3,vbDayString
GetDate>Date
GetTime>Time
Sen>%Date% %vbDayString% %Time%
Marcus, thanks a lot. I hope more built-in functions will be included in the Macro Scheduler.
Armstrong Wong
Spaces at end of lines in web page
Hi,
We have found a solution to the problem of the forum adding spaces to the end of lines causing script code copied and pasted into Macro Scheduler to sometimes work incorrectly.
The solution: When you paste code into your forum message please highlight the code and then press the 'Code' button that appears beneath the subject field - or alt+c. You will see help to this effect given on the posting page.
The code will look like this:
ExecuteFile>c:\program files\mjt net ltd\macro scheduler\command_ref_7.1.pdf
WaitWindowOpen>Acrobat Reader*
Press ALT
Send>fp
Release ALT
WaitWindowOpen>Print
Press Enter
WaitWindowOpen>Acrobat Reader
WaitWindowClosed>Acrobat Reader
SetFocus>Acrobat Reader*
Press ALT
Send>fx
Release ALT
You will notice that if you highlight it there are now no longer any invisble characters at the end of each line.
We have found a solution to the problem of the forum adding spaces to the end of lines causing script code copied and pasted into Macro Scheduler to sometimes work incorrectly.
The solution: When you paste code into your forum message please highlight the code and then press the 'Code' button that appears beneath the subject field - or alt+c. You will see help to this effect given on the posting page.
The code will look like this:
ExecuteFile>c:\program files\mjt net ltd\macro scheduler\command_ref_7.1.pdf
WaitWindowOpen>Acrobat Reader*
Press ALT
Send>fp
Release ALT
WaitWindowOpen>Print
Press Enter
WaitWindowOpen>Acrobat Reader
WaitWindowClosed>Acrobat Reader
SetFocus>Acrobat Reader*
Press ALT
Send>fx
Release ALT
You will notice that if you highlight it there are now no longer any invisble characters at the end of each line.
MJT Net Support
[email protected]
[email protected]
Hi Support,
You are not only pointing out the way to discover white space/control character(s) but also a wonderful idea to open a PDF file.
For some odd reason, when starting, Adobe Acrobat can't automatically open the last browsed PDF document.
Perhaps, in the future release, you may add "Find Whtie Space" under "View" in the main menubar of Macro Scheduler.
Thanks a lot.
Cheers,
Armstrong Wong
You are not only pointing out the way to discover white space/control character(s) but also a wonderful idea to open a PDF file.
For some odd reason, when starting, Adobe Acrobat can't automatically open the last browsed PDF document.
Perhaps, in the future release, you may add "Find Whtie Space" under "View" in the main menubar of Macro Scheduler.
Thanks a lot.
Cheers,
Armstrong Wong
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:

This does not sound like the quality answers we usually get from Macro Scheduler. This will only last for a few days by those of us who were fortunate to be reading this thread. As time goes on, others will not follow these steps and the subject will constantly come up with the same answer: Press the Code button as noted on 12/1902.

How about having the spaces have a visible non-std character, or a colored period or some other visible indicator. Many text/word processors have the option to display invisible spaces, why not try that approach here? Limit it to the blocks where we are entering the messages, leave the rest of the pages alone. What is needed is a solution that does not require message group to remember to do something special. It should automatically color or make visible the "invisible spaces" that entered into these boxes.
And incorporate the same feature into the Macro Editor to help catch those entries that are real typing errors vs. results of cut/paste. Make the visibility a user selected option.
I don't know how to do it, but I do know what the spec should be. Just one more suggestion.
Quite! The only way to do it would be to render the display of messages in plain text with no option for formatting.bob hansen wrote:I don't know how to do it, but I do know what the spec should be. Just one more suggestion.
I'm very sorry that you do not feel that this answer lacks quality.
Above the message editor when you post a message lies this line of text:
"If pasting script code, highlight it and press the 'Code' button to ensure it can be copied and pasted correctly. "
So there is a constant reminder.
We *could* change the system so that ALL lines of text don't have end of line chars, but the *only* way to do that in HTML is to use the tag which prevents any kind of reformatting. But this also leaves fixed width boring text and looks ghastly. Or we could get rid of the forums altogether.
I noticed someone report a problem where they had had dificulties pasting code into their Macro Scheduler from the forum. So I spent a day looking at the forum code to find a way to make sure the forum could display the script properly, found a solution and fixed it. And this is the thanks I get.

We have also taken on board various suggestions about ignoring spaces in variable names in future versions of Macro Scheduler, but a change to the Macro Scheduler code can't happen as quickly as a change to the forum code. And bear in mind that since variables and literals are interchangeable this isn't necessarily possible or desirable. How do you know it's a variable and not a literal? The text could be a sentence which should have a space in it. I still maintain that the issue here was with the way the code was displayed on the forum, not an issue with Macro Scheduler.
Now, I think we should leave this topic as it is in danger of going on forever.
MJT Net Support
[email protected]
[email protected]
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Stay tuned was correct. New version 7.1.17 has option to show invisible characters! And I just made that suggestion a few hours ago! You must have been ahead of me.
Re the message to press Code button, I may have read that text months ago, but never really registered with me. And it never catches my eyes now....sorry for not looking.
And I am certainly sorry for any personal grief you felt about my comment on that previous solution. This is the best software team that I have ever seen re responses, knowledge, and customer interaction. End the forum? NEVER!
I intended no personal criticism. I do know you have worked hard on this and all other issues., and it is appreciated.
Please accept my apology.
I agree, subject closed.

Re the message to press Code button, I may have read that text months ago, but never really registered with me. And it never catches my eyes now....sorry for not looking.

And I am certainly sorry for any personal grief you felt about my comment on that previous solution. This is the best software team that I have ever seen re responses, knowledge, and customer interaction. End the forum? NEVER!

I intended no personal criticism. I do know you have worked hard on this and all other issues., and it is appreciated.

Please accept my apology.
I agree, subject closed.

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