Negative1 Posted March 11, 2009 Share Posted March 11, 2009 I am currently writing a script for SAP without using the scripting GUI. In order to account for the many times that i have to wait on SAP to process something I have wrote this function: Func sapwait() $hWnd = WinGetHandle("[active]") $exstyle = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) while $exstyle <> 272;sap exstyle 256 means sap is processing something. 272 means SAP is Idle $hWnd = WinGetHandle("[active]") $exstyle = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) sleep(250) WEnd EndFunc When SAP is processing something ExStyle = 0x00000100 Idle ExStyle = 0x00000110 according to autoit window info tool. However i find this function usually returns to the main program too quickly and therefore my script starts back up at the wrong time. Any Ideas? Thanks, -1 What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world. Link to comment Share on other sites More sharing options...
Zedna Posted March 12, 2009 Share Posted March 12, 2009 (edited) Try this: Func sapwait() $hWnd = WinGetHandle("[active]") $exstyle = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) while $exstyle <> 272;sap exstyle 256 means sap is processing something. 272 means SAP is Idle $hWnd = WinGetHandle("[active]") $exstyle = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) sleep(250) WEnd sleep(250); added EndFunc I have some Autoit scripts for our IS similar to SAP and I use this for waiting till button is enabled: While ControlCommand('Title', "", "Button1","IsEnabled","") = 0 Sleep(50) WEnd While ControlCommand("Title", "", "ListBox1", "FindString", " ---------- Finished" ) = -1 Sleep(100) WEnd While 1 $text = WinGetText('Title') If StringInStr($text, 'Some text') > 0 Then ExitLoop Sleep(100) WEnd Sleep(500) You may also check state of cursor or some controls inside main application. Edited March 12, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
dantay9 Posted March 12, 2009 Share Posted March 12, 2009 I do know that there is a time lapse between the time the style changes and the time the window changes. That is about all I can help you with. Link to comment Share on other sites More sharing options...
jeweetwel Posted March 13, 2009 Share Posted March 13, 2009 I am currently writing a script for SAP without using the scripting GUI. In order to account for the many times that i have to wait on SAP to process something I have wrote this function: Func sapwait() $hWnd = WinGetHandle("[active]") $exstyle = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) while $exstyle <> 272;sap exstyle 256 means sap is processing something. 272 means SAP is Idle $hWnd = WinGetHandle("[active]") $exstyle = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) sleep(250) WEnd EndFunc When SAP is processing something ExStyle = 0x00000100 Idle ExStyle = 0x00000110 according to autoit window info tool. However i find this function usually returns to the main program too quickly and therefore my script starts back up at the wrong time. Any Ideas? Thanks, -1 Hi Negative1, I agree. Autoit needs longer break's soo i put after every sapwait a sleep 250. Your 250 miliseconds are not executed at the end of the cript, so i alwys put an extra wait of 250 miliseconds. This works fine........ Sometime's i also wait at a message to come in the statusbar. Thanks for the code by-the-way. If there is an other option, please share! Best regards, Rody Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now