Whitespace Variable Display Problem

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
Willaim Mitchell
Newbie
Posts: 6
Joined: Sun Nov 18, 2007 8:23 pm

Whitespace Variable Display Problem

Post by Willaim Mitchell » Fri May 09, 2008 11:30 pm

// Pointer Location and Pixel Color when CTRL-P is typed
GETCURSORPOS> X,Y
GETPixelCOLOR>X,Y,Color
MessageModal>X,%X%,Y,%Y%, Color,%Color%


If a leading blank is present when X is defined, a message will show the variable name (X) where the value should be.
Message Display after CTRL-P = X,%X%,Y,581, Color,14265756

Getting rid of the blank following "GETCURSORPOS>" fixes this problem however the value of X is correct and usable in expressions even when the display problem is present.
I am using Macro Scheduler 10.1.02 with XP SP3

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 » Sat May 10, 2008 7:21 am

Macro Scheduler recognizes spaces as "real" characters. They can not be used as delimiters, or space to make easier reading.
Let> x is not the same as Let>x.

This is true, anywhere on the line, escpecilly common error around equal signs.
Let>a = 15 is not the same as Let>a=15, and Let>a= 15 is also different.

Initially you may find this a problem, but will soon come to value the benefits of the literal variables.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Sat May 10, 2008 10:56 pm

You should also look into the use of IGNORESPACES. This setting will allow you to use spaces in some instances with no change in the value.

This is right out of the help file

By default, spaces are seen as regular characters and are included in variable assignments. E.g. The following line..

Let>a = 5

.. would create a variable called "a " with the value " 5".

Normally, therefore, you should use:

Let>a=5

But experienced programmers are used to the language ignoring spaces. This can be achieved by setting IGNORESPACES to 1:

Let>IGNORESPACES=1
Let>a = 5

This would set variable "a" to the value 5.

Willaim Mitchell
Newbie
Posts: 6
Joined: Sun Nov 18, 2007 8:23 pm

Whitespace

Post by Willaim Mitchell » Tue May 13, 2008 10:42 pm

Thanks for the IGNORESPACES suggestion. I will begin using it.

There still seems to be a problem with consistency because
GETCURSORPOS> X,Y
GETPixelCOLOR> X,Y,Color
MessageModal> X,% X%,Y,%Y%,Color,%Color%

has the same display error as when I tried to display %X%...that is the message shows the variable name instead of the value even if I use " X" everywhere.

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue May 13, 2008 10:48 pm

In a message, unless a variable is the ONLY item in the message, the variable must be surrounded by percents.

Try:
MessageModal> %X%,% X%,%Y%,% Y%,Color,%Color%

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

Re: Whitespace

Post by Marcus Tettmar » Wed May 14, 2008 7:59 am

Willaim Mitchell wrote:Thanks for the IGNORESPACES suggestion. I will begin using it.

There still seems to be a problem with consistency because
GETCURSORPOS> X,Y
GETPixelCOLOR> X,Y,Color
MessageModal> X,% X%,Y,%Y%,Color,%Color%

has the same display error as when I tried to display %X%...that is the message shows the variable name instead of the value even if I use " X" everywhere.
You have a space here: % X%. The line should be:

MessageModal> X,%X%,Y,%Y%,Color,%Color%

i.e. to use variables within strings they must have % symbols around them, with no spaces between the % symbols and the variable name.
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