Hi all,
Thanks for your great responses. I have actually managed to get this working. I have no idea how, I just ended up on a tangent from one of the suggestions and went from there.
Any way, here is my finished code.
Global $totalshipments = StatusbarGetText ("UPS WorldShip - Administrative Workstation", "", 4)
Global $totalshipments2 = ("0 total shpmt(s) Collection Rec: 0 00 0")
Global $totalshipments4 = BinaryToString ( $totalshipments)
if WinExists ("XML Auto Import", "") Then
ControlClick ("XML Auto Import", "", "[ID:17329]")
ControlClick ("UPS WorldShip", "", "[ID:6]")
ControlClick ("XML Auto Import", "", "[ID:15079]")
WinSetState("UPS WorldShip - Administrative Workstation", "", @SW_RESTORE)
WinActivate("UPS WorldShip - Administrative Workstation", "")
sleep(2000)
Send("{F3}")
sleep(10000)
send("{F11}")
sleep(2000)
Do
Sleep(1000)
until WinExists ("End of Day Processing", "You have shipments in your Remote, Deferred, Imported or In Error list. Would you like to cancel End of Day and process the shipments first?")
ControlClick ("End of Day Processing", "", "[CLASSNN:Button2]", "left", 1)
Do
Sleep(1000)
until WinExists ("End of Day Processing", "Are you ready to close today's shipping and send the shipment information to UPS?")
ControlClick ("End of Day Processing", "Are you ready to close today's shipping and send the shipment information to UPS?", "[CLASSNN:Button1]", "left", 1)
Else
WinMinimizeAll ()
WinSetState("UPS WorldShip - Administrative Workstation", "", @SW_RESTORE)
WinActivate("UPS WorldShip - Administrative Workstation", "")
sleep(2000)
Send("{F3}")
sleep(10000)
send("{F11}")
sleep(2000)
Do
Sleep(1000)
until WinExists ("End of Day Processing", "You have shipments in your Remote, Deferred, Imported or In Error list. Would you like to cancel End of Day and process the shipments first?")
ControlClick ("End of Day Processing", "", "[CLASSNN:Button2]", "left", 1)
Sleep(2000)
Do
Sleep(1000)
until WinExists ("End of Day Processing", "Are you ready to close today's shipping and send the shipment information to UPS?")
ControlClick ("End of Day Processing", "Are you ready to close today's shipping and send the shipment information to UPS?", "[CLASSNN:Button1]", "left", 1)
EndIf
Sleep (120000)
Send ("{F2}")
Sleep (10000)
Send ("{F3}")
Sleep (10000)
if $totalshipments4 == $totalshipments2 Then
Exit
Else
ShellExecuteWait("UPS EOD.msg", "", "Q:\mezzanine\Desktop\AutoIT tools\", "", @SW_MAXIMIZE)
Sleep(2000)
ControlClick ("UPS EOD - Message (HTML) ", "", 4256, "left", 1)
Sleep(2000)
EndIf
Exit
Thank you all for your help