Jump to content

Problem with _GUICtrlToolbar_ClickIndex


Recommended Posts

I have this segment of code that only seems to work some of the time. When it works, I get the _GUICtrlToolbar_ClickIndex opens up a sub-window and I wait until I can get focus on one of the controls before proceeding.

When it doesn't work, I successfully get a handle to the toolbar but the _GUICtrlToolbar_ClickIndex doesn't do anything so no sub-window and of course I can't get focus on the control which leaves me stuck in the loop.

$hToolbar= ControlGetHandle("InfoStore Client", "", "[CLASS:ToolbarWindow32; INSTANCE:1]")
_FileWriteLog(@ScriptDir & $LogFileName, "hToolbar = " & $hToolbar)
_GUICtrlToolbar_ClickIndex($hToolbar, 15)
do 
Sleep(1000)
until (ControlFocus("InfoStore Client", "",  "[CLASS:ThunderRT6ComboBox; INSTANCE:3]") = 1)

The most important question for me is why does the _GUICtrlToolbar_ClickIndex fail? Could it be that when it fails, I am typically not logged in on the computer that the script is running on?

From a best programming practise perspective, what is a better way of programming the loop where I test for being able to get focus on the control so that I can handle the fact that there is a problem without gettingstuck in that loop?

Take Care

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...