Jump to content
Sign in to follow this  
slayerbulia

Chek if all controls are ready

Recommended Posts

slayerbulia

Here is a newbee question:

How can I check what all controls in the app are ready? for example then Word is starting the window with the title appears previous to the Menus and tabs.

Share this post


Link to post
Share on other sites
TurionAltec

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")

Share this post


Link to post
Share on other sites
slayerbulia

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.