Hints, tips and tricks for newbies
Moderators: Dorian (MJT support), JRL
-
ari
- Junior Coder
- Posts: 23
- Joined: Tue Jul 15, 2014 4:12 pm
Post
by ari » Mon Aug 11, 2014 9:08 pm
Code: Select all
Let>WSI_TIMEOUT=3
WaitScreenImage>c:\imagedir\image_1.bmp,0,EXACT
If>WSI_TIMEOUT=true
Exit>
Endif
I am assuming there is something wrong with this code, as the macro continues onward (instead of quitting) executing commands after the Endif even if the image.bmp does not appear in 3 seconds
(when the image is present, the macro executes normally and correctly)
P.S. I bought MS14 this week, thanks for the great product
-
hagchr
- Automation Wizard
- Posts: 331
- Joined: Mon Jul 05, 2010 7:53 am
- Location: Stockholm, Sweden
Post
by hagchr » Mon Aug 11, 2014 11:12 pm
I think you need to use WSI_TIMEDOUT instead of WSI_TIMEOUT for the second check (small spelling difference - WSI_TIMEOUT sets the timeout in seconds and WSI_TIMEDOUT shows if the function "timed out" or not - TRUE/FALSE).
-
CyberCitizen
- Automation Wizard
- Posts: 723
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Post
by CyberCitizen » Tue Aug 12, 2014 2:05 am
You Need To Specify An Exit Code.
Exit>0
FIREFIGHTER
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Tue Aug 12, 2014 2:47 pm
CyberCitizen wrote:You Need To Specify An Exit Code.
Actually, I often leave off the return code and Exit> works just fine. Maybe I'm being foolish and there will come a time when those lines with no parameter specified will fail.
Is the return code for the Exit> function optional by design or does it just happen work that way now?
I think hagchr hit the nail on the head. You have to use the correct variable. I also wanted to emphasize that all Macro Scheduler variable results are case sensitive. "true" is not equal to "TRUE". Since the results for "WSI_TIMEDOUT" are upper case, either the test needs to be for an upper case "TRUE", If>WSI_TIMEOUT=TRUE, Or the result needs to be preconditioned using the UpperCase> function or the LowerCase> function.
Code: Select all
Let>WSI_TIMEOUT=3
WaitScreenImage>c:\imagedir\image_1.bmp,0,EXACT
LowerCase>WSI_TIMEDOUT,WSI_TIMEDOUT
If>WSI_TIMEDOUT=true
Exit>
Endif
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Tue Aug 12, 2014 3:14 pm
CyberCitizen wrote:You Need To Specify An Exit Code.
Exit>0
That's not the issue. Ari is checking if WSI_TIMEOUT is true. It won't be. It's already been set to 3. Ari needs to check WSI_TIME
DOUT as hagchr says.
-
ari
- Junior Coder
- Posts: 23
- Joined: Tue Jul 15, 2014 4:12 pm
Post
by ari » Tue Aug 12, 2014 7:36 pm
I was wrong on 2 fronts, timeD out, and the lower case TRUE/FALSE! Thanks, very educational and this makes my scripts a lot more useful (vs. watching closely and shift+esc when the script is done)
-
CyberCitizen
- Automation Wizard
- Posts: 723
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Post
by CyberCitizen » Tue Aug 12, 2014 10:36 pm
My apologies, I only had a quick glance while on the train via my phone. That was what jumped out at me. Should I looked at it further.
FIREFIGHTER