Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
armsys
- Automation Wizard
- Posts: 1108
- Joined: Wed Dec 04, 2002 10:28 am
- Location: Hong Kong
Post
by armsys » Thu Feb 03, 2011 8:54 am
After repeated tests, I discover a mystery stemming from If..Endif construct.
Referring to the following code, let's assume notepad* exists. In fact, in accordance with MS Debugger, the SetFocus>notepad* runs successfully.
Run>me.exe is still executed. But why?
Code: Select all
IfWindowOpen>notepad*
SetFocus>notepad*
Else
If>{pos("ABC", %COMPUTER_NAME%)=1}
//Do Something here
Endif
Run>me.exe
Endif
Happy Chinese Lunar New Year of the Rabbit.
Last edited by
armsys on Thu Feb 03, 2011 9:16 am, edited 2 times in total.
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Thu Feb 03, 2011 9:03 am
Seems to be caused by the complex expression. This works fine:
Code: Select all
IfWindowOpen>notepad*
SetFocus>notepad*
Else
Let>x={pos("ABC", %COMPUTER_NAME%)}
If>x=1
//Do Something here
Endif
Run>me.exe
Endif
I will get this investigated.
-
armsys
- Automation Wizard
- Posts: 1108
- Joined: Wed Dec 04, 2002 10:28 am
- Location: Hong Kong
Post
by armsys » Thu Feb 03, 2011 9:14 am
Marcus, thanks for your fast help.
My recent intensive use of complex expressions seems bumpy.
I took me some time to discover the freaky path of the execution.
Before I didn't know it could be caused by the complex expression.
At last, the myth is confirmed.
-
PepsiHog
- Automation Wizard
- Posts: 517
- Joined: Wed Apr 08, 2009 4:19 pm
- Location: Florida
Post
by PepsiHog » Thu Feb 03, 2011 1:56 pm
Marcus,
While on the subject. Why must the types in a complex expression be the same? It seems like this restriction really limits the usefulness of complex expressions. Could you make multiple types possible?
Thanks.
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!