undream Posted March 13, 2012 Share Posted March 13, 2012 Hello everyone. I'm trying to send commands to a toolbar button, which opens up a window. And then I want to press another button in that window to execute a command. Here is the code that opens the window named "send settings" (bysending the button command) ControlCommand ( $APP, "", $handleToolbar, "SendCommandID", 32820) and here is the code that closes the window named "send settings" (again via button command") ControlCommand ( "Send Set", "", "[CLASS:Static; INSTANCE:14]", "SendCommandID", 1) Both of them works. When I run the first command only, it opens up the second window. When I open up the vindow by hand and send up the second code line, it "executes" and closes the second window action. However, when the code is stucked like this, the second windows never closes, its like the second command is not even there: ControlCommand ( $APP, "", $handleToolbar, "SendCommandID", 32820) Sleep(1000) ControlCommand ( "Send Set", "", "[CLASS:Static; INSTANCE:14]", "SendCommandID", 1) Why can this be ? Do you have any ideas ? I've tried playing with the sleep time too, it didnt do any change. Link to comment Share on other sites More sharing options...
JohnOne Posted March 13, 2012 Share Posted March 13, 2012 Wait for window to Exist. WinWait / WinWaitActive. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
undream Posted March 13, 2012 Author Share Posted March 13, 2012 Tried, still the same. Nothing changed. The opening windows opens instantly anyway. Link to comment Share on other sites More sharing options...
Varian Posted March 13, 2012 Share Posted March 13, 2012 (edited) Are you sure that it is not a timing thing, as JohnOne suggested? Try this: Do ControlCommand($APP, "", $HandleToolbar, "SendCommandID", 32820) Sleep(100) Until WinExists('2ndWindow') Do Sleep(100) Until ControlCommand("Send Set", "", "[CLASS:Static; INSTANCE:14]", "IsEnabled", "") ;wait for control on Window 2 to be ready for Input Sleep(1000) ;your arbitray wait time Do ControlCommand("Send Set", "", "[CLASS:Static; INSTANCE:14]", "SendCommandID", 1) Sleep(100) Until Not WinExists('2ndWindow') Edited March 13, 2012 by Varian 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