Sign in to follow this  
Followers 0
Vincent

Sending mouse clicks to minimized application

4 posts in this topic

Hi, all. Is there anyone know how to send "mouse clicks" to the file menu of a minimzed appliatin (e.g. go File->exit from the minimized MS Word)?

I am asking this since I can't do anything while I run my script except sitting back and wait till the execution of my script is over, otherwise, say if I want to edit my code while I am executing my script, my script will "Exit" my editor. Is there anyway to avoid this situation?

thanks all!!!

;)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Look up "WinMenuSelectItem" in the help files. This does not actually do any clicking since that would be impossible for minimized windows, but it works just the same for programs that use regular Microsoft controls. Also watch out for those underlined letters, since they might not show themselves unless you press ALT. Your line might look something like this:

WinMenuSelectItem("Microsoft Word","","&File","E&xit")

Edited by Sokko

Share this post


Link to post
Share on other sites

Look up "WinMenuSelectItem" in the help files. This does not actually do any clicking since that would be impossible for minimized windows, but it works just the same for programs that use regular Microsoft controls. Also watch out for those underlined letters, since they might not show themselves unless you press ALT. Your line might look something like this:

WinMenuSelectItem("Microsoft Word","","&File","E&xit")

Thanks

So will that work even after I minized the target application (e.g. I wan that script to work on the Notepad. Will it still work even after I minimized the notepad and the Window Media Player?

;)

Share this post


Link to post
Share on other sites

So will that work even after I minized the target application (e.g. I wan that script to work on the Notepad. Will it still work even after I minimized the notepad and the Window Media Player?

Of course. Here's a quick example that opens Notepad, minimizes it, and then closes it using the WinMenuSelectItem function.

Run("notepad.exe")
Sleep(1000)
WinSetState("Untitled","",@SW_MINIMIZE)
Sleep(3000)
WinMenuSelectItem("Untitled","","&File","E&xit")

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