Sign in to follow this  
Followers 0
divya

win wait active function

6 posts in this topic

Hello all,

 

            I am using win wait active function( which  takes the title of the window as input )to pause the script until a particular window with the given title pops up.My script was not waiting till the window was fully loaded, instead its just recognising the title and executing the script.  

            I used sleep function, but it doesn't seems to be generic as the duration varies for diferent machines. Is there any function which waits till the window is fully loaded.

 

            Please do share, if you have any idea.

Thank you

Share this post


Link to post
Share on other sites



WinWaitActive should wait for the window to be active..

Could you show us the code?


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

Is there a line of text in the program's window that appears when the program is 'active enough' for your script to proceed? There is a text parameter for WinWaitActive function. You could use the ControlCommand function to check any buttons or other kind of control to be active or inactive.. When and if you post your code, please use the autoit tags, or the blue button with an A.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

I usually use WinWaitActive of winwaitclose then, that means I wait for the window is really present and if present hope to continue to be close to the action, but in your script wait for the window to appear immediately and will continue running to the next step, not needed to sleep.

Simple Exapmle:

Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]", "")
WinWaitClose("[CLASS:Notepad]")
MsgBox(0,"Continue Script","Notepad its closed"&@CRLF&"Here Continue Script")

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Being active does not mean the window is enabled...a window must be enabled to accept clicks, sends, etc

WinGetState

Loop through ^ until enabled is included (check with BitAnd).

I also like to then loop until my controls is present, and enabled.

ControlGetHandle
ControlCommand

It makes a script that runs 90% of the time, run 99% of the time.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Oh yeah, I forgot about the WinGetState function. That'll most probably do the trick.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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  
Followers 0