Detecting computer

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Conrad51
Newbie
Posts: 4
Joined: Mon Feb 23, 2009 9:06 am

Detecting computer

Post by Conrad51 » Mon Feb 23, 2009 10:05 am

I´m running the same macro on two computers. The mousemove
should be different on the two computers. Unfortunately it doesn´t
work like below. The macro takes the first two values undependent
of which computer I´m using.
Could anybody please advice me what is wrong with the macro?


//messagemodal>COMPUTER_NAME
IF COMPUTER_NAME=HP30222709268
Let Mus1=492
Let Mus2=369
ELSE
Let Mus1=492
Let Mus2=343
ENDIF
MouseMove>Mus1,Mus2

Bests
Cnrad

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

Post by JRL » Mon Feb 23, 2009 1:37 pm

Most Macro Scheduler functions require a greater than symbol ">" as a delimiter between the function and the rest of the parameters. You have not included that symbol in your If> statement. For some reason the Let> function works without the greater than symbol so there's a bit of confusion. Anyway if you look up a function's syntax in help, it will tell you when you need or don't need the greater than symbol.

Its easy to see help for a particular function once you have the name typed into the editor. while the cursor is on the function line, press F1.

try tjhis:

Code: Select all

//messagemodal>COMPUTER_NAME
IF>COMPUTER_NAME=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2

chihuahualand
Junior Coder
Posts: 35
Joined: Thu Jan 12, 2006 9:20 pm
Contact:

Post by chihuahualand » Tue Feb 24, 2009 8:53 pm

I suspect the lack of greater thans (>) is not part of the issue.

You've tried a
MessageModal>%mus1%%CRLF%%mus2%

and you get the same results? ... then there's a problem with the computer name... check for Oh's and zeros... or trailing spaces... etc... there's an equivalency problem

best of luck

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

Post by JRL » Tue Feb 24, 2009 9:16 pm

I suspect the lack of greater than (>) is not part of the issue.
The lack of the greater than is ABSOLUTELY a part of the issue. If you leave out the greater than, the "IF" test fails and will always ONLY process the script portion before the "ELSE".

Try the following:

Code: Select all

Let>a=1

If a=2
    Let>b=2
Else
    Let>b=3
EndIf

MDL>b = %b%
Since "a" is set to 1, the value of "b" should be set to 3 but this script will never process the lines after the else because the greater than symbol is missing from the If statement. I tested this in version 10 and version 11. I don't know how prior versions will handle this.

There still could be an issue with matching text to the COMPUTER_NAME variable. But until the correct syntax is used you'll never know.

chihuahualand
Junior Coder
Posts: 35
Joined: Thu Jan 12, 2006 9:20 pm
Contact:

Post by chihuahualand » Tue Feb 24, 2009 9:26 pm

I stand corrected

Conrad51
Newbie
Posts: 4
Joined: Mon Feb 23, 2009 9:06 am

Post by Conrad51 » Sun Mar 01, 2009 12:43 pm

Thanks JRL for you help!
It seems however to be something strange about this.
Your correct code doesn´t work either

//messagemodal>COMPUTER_NAME
IF>COMPUTER_NAME=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2


But if I change to something more clumsy it works

/messagemodal>COMPUTER_NAME
IF>COMPUTER_NAME=HP30222709268
Let>Computer=Home
ELSE
Let>Computer=Work
ENDIF

If>Computer=Home
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF

MouseMove>Mus1,Mus2

I´ve seen this behaviour before, a bug in the program?

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

Post by JRL » Mon Mar 02, 2009 6:38 am

If I substitute my computer name, this works just fine for me.

IF>COMPUTER_NAME=HOME-II
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2


You haven't said what version of Macro Scheduler you're using. And how is the code
//messagemodal>COMPUTER_NAME
IF>COMPUTER_NAME=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2

failing?

Conrad51
Newbie
Posts: 4
Joined: Mon Feb 23, 2009 9:06 am

Post by Conrad51 » Thu Mar 05, 2009 10:43 pm

Thank you JRL for your continued help!

I´m using version 11.1.05 standard.
The code fails while Macro Scheduler doesn´t make a choice between
the first and second option, it just steps through the code and ends
up with Mus1=492 and Mus2=343 independent if it is my work computer or
my home computer. With my "clumsy" version it works

//messagemodal>COMPUTER_NAME
IF>COMPUTER_NAME=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2

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 » Thu Mar 05, 2009 11:35 pm

This code works fine for me, XP PRO SP2, Macro Scheduler 11.1.05

Code: Select all

IF>COMPUTER_NAME=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2
Mus2 changes based on matching COMPUTER_NAME
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by JRL » Fri Mar 06, 2009 1:25 am

Run the following and log the result. post the log.

Code: Select all

//messagemodal>COMPUTER_NAME
IF>%COMPUTER_NAME%=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>%Mus1%,%Mus2%

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Mar 06, 2009 5:34 am

Hi Conrad51,

Code: Select all

//messagemodal>COMPUTER_NAME 
IF>COMPUTER_NAME=HP30222709268 
Let>Mus1=492 
Let>Mus2=369 
ELSE 
Let>Mus1=492 
Let>Mus2=343 
ENDIF 
MouseMove>Mus1,Mus2
When I substitute my computer name into your code as you posted it above... it runs as I would expect... the first two values are set. I am running 11.1.05 on XP SP3 as well.

My guess would be that maybe you've typed a zero 0 where a letter O should have been in your computer name value. If you just copy and paste the string displayed when you run the following line...

Code: Select all

messagemodal>COMPUTER_NAME
...you should be OK.

One other thing, I'm not sure if its possible but if it is... you may have a trailing space character in your computer name. If that's there, you'd need to include it at the end of the value you have there in the IF> statement... to get it to match properly.

Here's a quick way to test to see if there are trailing spaces in your computer name:

Code: Select all

Length>COMPUTER_NAME,count
MDL>%COMPUTER_NAME%%CRLF%%count%
If the number of characters displayed matches the count, you're fine, but if the count is larger, you may have a trailing space.

Please let us know your findings...


Sidenote: Marcus - there's a problem with the color syntax highlighting.

1) paste the following code between the lines below (not including the lines) into a new macro

-------------------------------------------
//messagemodal>COMPUTER_NAME
IF>COMPUTER_NAME=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2
-------------------------------------------

2) Edit/Remove Trailing Spaces

3) Delete the first two // characters in the first line

The first line then looks like this for me:

messagemodal>COMPUTER_NAME

But it should look like this:

messagemodal>COMPUTER_NAME

If you copy and paste that first line lower down... color syntax highlighting comes out right.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

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

Post by Marcus Tettmar » Fri Mar 06, 2009 9:12 am

Sidenote: Marcus - there's a problem with the color syntax highlighting.
I've tried to explain this before. In the interests of performance and usability there is sometimes a delay before syntax highlighting happens and sometimes further edits are required. If you insert a new line before the message modal it will highlight correctly.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Conrad51
Newbie
Posts: 4
Joined: Mon Feb 23, 2009 9:06 am

Post by Conrad51 » Fri Mar 06, 2009 7:42 pm

If I add % on both sides of COMPUTER_NAME like JRL proposed
it works! However it is not needed to add % to Mus1 and Mus2.
I want to thank all of you who tried to help me


IF>%COMPUTER_NAME%=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>%Mus1%,%Mus2%

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sat Mar 07, 2009 10:11 pm

mtettmar wrote:
Sidenote: Marcus - there's a problem with the color syntax highlighting.
I've tried to explain this before. In the interests of performance and usability there is sometimes a delay before syntax highlighting happens and sometimes further edits are required. If you insert a new line before the message modal it will highlight correctly.
Thanks for the reply. So its a known issue... not a bug... a trade-off being made for the reasons you stated.

Sorry, I suppose if I had searched the forums... I might have found where you tried to explain that before.

On the other hand, if there were a place we could go to review a list of "known issues" before posting a possible bug... that would sure help. We sort of had that before with BugTracker... but now, searching the forums is the only recourse... and hoping we've picked the correct words to search on.

Take care
Last edited by jpuziano on Sat Mar 07, 2009 10:43 pm, edited 1 time in total.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sat Mar 07, 2009 10:41 pm

Conrad51 wrote:If I add % on both sides of COMPUTER_NAME like JRL proposed
it works! However it is not needed to add % to Mus1 and Mus2.
I want to thank all of you who tried to help me


IF>%COMPUTER_NAME%=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>%Mus1%,%Mus2%
Hi Conrad51,

Are you saying that on your machine, this code:

SCRIPT A

Code: Select all

IF>%COMPUTER_NAME%=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2
MDL>Mus2
behaves differently from the code below?

SCRIPT B

Code: Select all

IF>COMPUTER_NAME=HP30222709268
Let>Mus1=492
Let>Mus2=369
ELSE
Let>Mus1=492
Let>Mus2=343
ENDIF
MouseMove>Mus1,Mus2
MDL>Mus2
You said "it is not needed to add % to Mus1 and Mus2" so I took them out.

The only difference between the two scripts above are the percent % symbols around COMPUTER_NAME.

I threw in the following line...

MDL>Mus2

...to make it easy to see what happened.

If the If statement on the first line of code matches, then Mus2 is going to be 369.

If the If statement on the first line of code does not match, then Mus2 is going to be 343.

From what I can see, script A and B should behave exactly the same if run on the same machine... they did for me when I substituted in the proper value for COMPUTER_NAME on this machine.

However, if script A and B don't behave exactly the same for you Conrad51... then there's still a mystery here that should be solved.

Please let us know and take care.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

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