Jump to content

Weird ControlCommand issue..


Recommended Posts

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

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 by Varian
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...