Jump to content

Chek if all controls are ready


Recommended Posts

You could make the window text argument of Winwait look for something that's part of a control. This works on Word 2003:

Opt("Wintitlematchmode",2)
ShellExecute("winword.exe")

WinWait("Microsoft Word","Menu Bar")
Msgbox(0,"Found",  "Found word")

Alternatively, you can try getting a Control handle, and keep checking until the handle is a valid number. I put a sleep in the loop so it won't kill the CPU. I chose the main document control because toolbars may be customized:

Opt("Wintitlematchmode",2)
ShellExecute("winword.exe")

Do
    Sleep (100)
Until ControlGetHandle("Microsoft Word","","[CLASSNN:_WwG1]") <> ""
Msgbox(0,"Found",  "Found word")
Link to comment
Share on other sites

You could make the window text argument of Winwait look for something that's part of a control. This works on Word 2003:

Opt("Wintitlematchmode",2)
ShellExecute("winword.exe")

WinWait("Microsoft Word","Menu Bar")
Msgbox(0,"Found",  "Found word")

Alternatively, you can try getting a Control handle, and keep checking until the handle is a valid number. I put a sleep in the loop so it won't kill the CPU. I chose the main document control because toolbars may be customized:

Opt("Wintitlematchmode",2)
ShellExecute("winword.exe")

Do
    Sleep (100)
Until ControlGetHandle("Microsoft Word","","[CLASSNN:_WwG1]") <> ""
Msgbox(0,"Found",  "Found word")

This message appears a moment before the Menu Bar in fact becames visible...
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...