SendKeys method to a minimized application 
Author Message
 SendKeys method to a minimized application

Dim Shell
Set Shell = CreateObject("Wscript.Shell")
shell.run "notepad",2   'launch notepad minimized
wscript.sleep 1000
shell.appactivate "untitled - notepad"
shell.sendkeys "% x"    'maximize notepad
wscript.sleep 2000
shell.appactivate "untitled - notepad"
shell.sendkeys "% n"    'minimize notepad again



: I have been trying to use WSH to automate some actions in an
application
: that is minimized at the time, but have been unable to do so.
:
: a) If I use AppActivate followed by SendKeys, nothing appears to
happen in
: the minimized application.
:
: b)On the other hand, I have been unable to find a way to maximize or
restore
: the minimized application.
:
: c) If I maximize the application manually, before invoking the
script that
: activates it and then SendKeys to it, the required actions seem to
take
: place.
:
: Can anyone help me with this?
:
: John W Gross
:
:



Fri, 10 Jan 2003 03:00:00 GMT  
 SendKeys method to a minimized application
I have been trying to use WSH to automate some actions in an application
that is minimized at the time, but have been unable to do so.

a) If I use AppActivate followed by SendKeys, nothing appears to happen in
the minimized application.

b)On the other hand, I have been unable to find a way to maximize or restore
the minimized application.

c) If I maximize the application manually, before invoking the script that
activates it and then SendKeys to it, the required actions seem to take
place.

Can anyone help me with this?

John W Gross



Sat, 11 Jan 2003 03:00:00 GMT  
 SendKeys method to a minimized application
The problem: SendKeys just fills the Windows message queue. The content of
this
queue goes to the window having the focus. You can use the solution Walter
Zackery
posted to direct the focus to the minimized application and send some
keystrokes
using SendKeys.

G. Born

--
____________________________
Check out the WSH Bazaar at:
www.borncity.com


Quote:
> I have been trying to use WSH to automate some actions in an application
> that is minimized at the time, but have been unable to do so.

> a) If I use AppActivate followed by SendKeys, nothing appears to happen in
> the minimized application.

> b)On the other hand, I have been unable to find a way to maximize or
restore
> the minimized application.

> c) If I maximize the application manually, before invoking the script that
> activates it and then SendKeys to it, the required actions seem to take
> place.

> Can anyone help me with this?

> John W Gross



Sat, 11 Jan 2003 03:00:00 GMT  
 SendKeys method to a minimized application
I have tried Walter Zackery's suggestion, but for me it does nothing more
than run Notepad as a minimized window.

Also, I note that (at the times when the SendKeys method is invoked to send
the 'percent-x' and 'percent-n' to the application - that is, after the
pauses caused by the Sleep method) there is a beep... which suggests to me
that some sort of error has been detected, or at least that there is
something for the user to be aware of, but what?

In the Microsoft documentation for WSH, under AppActivate, the following
statements appear:

"The AppActivate statement changes the focus to the named application or
window but does not affect whether it is maximized or minimized. .... Use
the Shell function to start application and set the window style."

Can anyone tell me precisely what this "Shell function" is and where I might
be able to find some documentation on it?

John W Gross



Mon, 13 Jan 2003 03:00:00 GMT  
 SendKeys method to a minimized application
I think they mean the run method. Just be aware that many applications have
their initial state hardcoded into them. eg, Outlook will not start
minimize.


Quote:
> I have tried Walter Zackery's suggestion, but for me it does nothing more
> than run Notepad as a minimized window.

> Also, I note that (at the times when the SendKeys method is invoked to
send
> the 'percent-x' and 'percent-n' to the application - that is, after the
> pauses caused by the Sleep method) there is a beep... which suggests to me
> that some sort of error has been detected, or at least that there is
> something for the user to be aware of, but what?

> In the Microsoft documentation for WSH, under AppActivate, the following
> statements appear:

> "The AppActivate statement changes the focus to the named application or
> window but does not affect whether it is maximized or minimized. .... Use
> the Shell function to start application and set the window style."

> Can anyone tell me precisely what this "Shell function" is and where I
might
> be able to find some documentation on it?

> John W Gross



Mon, 13 Jan 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Using the Sendkeys Method for Automating an application

2. Maximizing a Minimized Application

3. Maximizing a minimized application

4. Using Sendkeys Method to Automate another program

5. SendKeys method

6. Sendkeys: method not supported

7. SendKeys method and keypad

8. SendKeys Method without being Visible

9. sendkeys method and unicode characters

10. Alternative to SendKeys method

11. Access application menu without sendkeys?

12. Using SendKeys with a non-object application

 

 
Powered by phpBB® Forum Software