DoW> Command

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Armstrong

DoW> Command

Post by Armstrong » Fri Dec 06, 2002 3:39 am

Is it possible to have a cDOW> command to generate a character string for the day of week? Thanks.

Armstrong Wong

Guest

Post by Guest » Fri Dec 06, 2002 10:18 am

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

Armstrong

VBScript Error

Post by Armstrong » Fri Dec 06, 2002 12:26 pm

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

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

Post by Marcus Tettmar » Fri Dec 06, 2002 12:44 pm

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?

Armstrong

cDoW

Post by Armstrong » Fri Dec 06, 2002 1:20 pm

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

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Spaces at end of lines in web page

Post by support » Thu Dec 19, 2002 8:56 pm

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.
MJT Net Support
[email protected]

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Dec 19, 2002 9:32 pm

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

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 » Fri Dec 20, 2002 3:39 am

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

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Dec 20, 2002 11:04 am

bob hansen wrote: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.

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]

Ernest

Post by Ernest » Fri Dec 20, 2002 11:36 am

That's it,
as long as this issue is already known, we have to stay tuned ... :wink:
(maybe a general hint in "Important Announcements"
Issue: "Use of code copied from forum" could be usefull).

Ernest

Keep cool 8)

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 » Fri Dec 20, 2002 9:53 pm

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.

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

:oops:
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!

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

:oops:
Please accept my apology.

I agree, subject closed. :oops:

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 » Fri Dec 20, 2002 10:45 pm

Note that my last reference should have been to version 1.1.13, not 1.1.17.

(I thought that was the version noted on the release message).

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Dec 21, 2002 2:42 am

Bob Hansen,

Take it easy. Reading from the tone of Ernst's messages, he was enthusiastic and passionate in expounding his view, but showing no sign of displeasure.

Gratefully thanking for your tip of 7.1.13 release.

Have a nice weekend.

Cheers,
Armstrong Wong
Hong Kong

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