Loop not working

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Loop not working

Post by gchichester » Thu Oct 15, 2020 2:54 pm

Does anyone see what would stop this loop from working?
I have confirmed that "result" does return SHIPMENT ADDED
While the code is running I don't see the ALT-R (Refresh) button in the window turn active
I have to refresh manually.

[size=85][code]Let>FIP_SCANPIXELS=ALL
WaitWindowOpen>Export Manager - [E0HSEG: House/Master Common Information]
SetFocus>Export Manager - [E0HSEG: House/Master Common Information]
Wait>sw
GetTextInit
GetTextInRect>626,460,803,476,result

Label>WaitForUpdate
Wait>1
If>result=SHIPMENT ADDED
Goto>Done
Else
Press Alt
Send>{"r"}
Release Alt
Wait>1
Goto>WaitForUpdate
EndIf

Label>Done
Wait>sw
MouseMove>1010,740
Wait>sw
Lclick
Wait>lw
[/code][/size][/size][/size]
Thank you in advance for all your help
Gil

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

Re: Loop not working

Post by JRL » Thu Oct 15, 2020 4:03 pm

I don't know what you actually want to accomplish but your code is written such that:
If>result=SHIPMENT ADDED
You will not Press Alt + r
Maybe you want:
If>result<>SHIPMENT ADDED

Or perhaps If>result={"SHIPMENT ADDED"}

Otherwise, if you haven't already:
- Make sure there's no trailing space on variable "result". I use trim> often. Trim>result,result

- Try writing variable "result" to a file then examine that file with your favorite hex editor or Notepad++ so you can determine if there are any extra "invisible" characters.

- Make sure variable "result" case is correct.

- You have proven that result returns "SHIPMENT ADDED". If you did that in the editor, maybe its not happening when you run the script. I like to place the "GetTextInit" function way forward from where I actually use a function to acquire text. If that can't be done, place a one second wait between "GetTextInit" and the text acquisition function.

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