Hi,guys
I have a problem.how to use if with And and OR including system Valiable...?
For Example: I am using PC with computername snake
If>{(%COMPUTER_NAME%="sn1") or (%COMPUTER_NAME%="sn2")}
MessageModal>%COMPUTER_NAME%
Do stuff...
Endif
It doesnot work. Why? something wrong with spaces?
problem to use if with And and OR...?
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 28
- Joined: Wed Jun 08, 2005 2:48 pm
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I see no problem with the syntax. This works for me:
You don't show the full script where the variables are assigned values.
Remember that variables are Case Sensitive.
Also remember to Remove Trailing Spaces
Using 7.3.11.4
Code: Select all
Let>COMPUTER_NAME=sn1
//Toggle next line with previous line for testing
//Let>COMPUTER_NAME=sn2 (\
If>{(%COMPUTER_NAME%="sn1") or (%COMPUTER_NAME%="sn2")}
MessageModal>%COMPUTER_NAME%
//Do stuff...
Endif
Remember that variables are Case Sensitive.
Also remember to Remove Trailing Spaces
Using 7.3.11.4
Last edited by Bob Hansen on Tue Jul 19, 2005 4:28 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Which version of Macro Scheduler do you have? Check under Help/About.
MJT Net Support
[email protected]
[email protected]
-
- Junior Coder
- Posts: 28
- Joined: Wed Jun 08, 2005 2:48 pm
my MS version is 7.3.11.4
my MS version is 7.3.11.4
-
- Junior Coder
- Posts: 28
- Joined: Wed Jun 08, 2005 2:48 pm
help me!
ok,I have made a small test.
I want to check the computername that I use currently.if the PCs with the name that i expect, it will show a messagebox with the name of PC.
COMPUTER_NAME is system Variable from MacroScheduler.
If>%COMPUTER_NAME%="PC1234"
MessageModal>%COMPUTER_NAME%
Endif
And I go to PC1234, run the script above,nothing happens.It does not work.
when I run just "MessageModal>%COMPUTER_NAME%" ,without If/Endif.It works fine.But I donot want all PCs to show its name.Help me please!
I want to check the computername that I use currently.if the PCs with the name that i expect, it will show a messagebox with the name of PC.
COMPUTER_NAME is system Variable from MacroScheduler.
If>%COMPUTER_NAME%="PC1234"
MessageModal>%COMPUTER_NAME%
Endif
And I go to PC1234, run the script above,nothing happens.It does not work.
when I run just "MessageModal>%COMPUTER_NAME%" ,without If/Endif.It works fine.But I donot want all PCs to show its name.Help me please!
You don't need or want the quotes around the computer's name. Try:
If>%COMPUTER_NAME%=PC1234
MessageModal>%COMPUTER_NAME%
Endif
On the other hand, if you were using complex if statements as in your original posting, the quotes are necessary.
Quoting form the Macro Scheduler help for complex expressions:
Dick
If>%COMPUTER_NAME%=PC1234
MessageModal>%COMPUTER_NAME%
Endif
On the other hand, if you were using complex if statements as in your original posting, the quotes are necessary.
Quoting form the Macro Scheduler help for complex expressions:
Hope this helps,The expression must be contained within curly braces "{" and "}". String literals must be delimited with double quotes ("), e.g.: "string".
Variables must be delimited with % symbols, e.g.: %VarA%.
Dick