Using VBScript to minimize, restore/maximize, close window 
Author Message
 Using VBScript to minimize, restore/maximize, close window

I would like use VBScript to do the equivilant of mouseclicking to
minimize, maximize/restore or close a window in which I have
made sendkey entries. I assume one procedure works for all windows
with the minimize, restore/maximize, close button.

set Shell = WScript.CreateObject("WScript.Shell")
shell.run "notepad"  
wscript.sleep(5000)
shell.sendkeys("test")
'>>> procedure to minimize, restore/maximize, close window



Sun, 12 Oct 2003 09:58:11 GMT  
 Using VBScript to minimize, restore/maximize, close window
Note that the WScript.Sleep calls are more for effect in demonstration than anything else.
Depending on the keystrokes you send and the responsiveness of the application, you may have to use
a few strategically placed WScript.Sleep calls to let the application react...

=======================================

set shell = createobject("wscript.shell")
shell.run "about:blank"

wscript.sleep 2000
success = shell.appactivate("about:blank")
if success then shell.sendkeys "% n"  '...minimize

wscript.sleep 2000
success = shell.appactivate("about:blank")
if success then shell.sendkeys "% x"  '...maximize

wscript.sleep 2000
success = shell.appactivate("about:blank")
if success then shell.sendkeys "% r"  '...restore

wscript.sleep 2000
success = shell.appactivate("about:blank")
if success then shell.sendkeys "%{F4}"  '...maximize

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> I would like use VBScript to do the equivilant of mouseclicking to
> minimize, maximize/restore or close a window in which I have
> made sendkey entries. I assume one procedure works for all windows
> with the minimize, restore/maximize, close button.

> set Shell = WScript.CreateObject("WScript.Shell")
> shell.run "notepad"
> wscript.sleep(5000)
> shell.sendkeys("test")
> '>>> procedure to minimize, restore/maximize, close window



Sun, 12 Oct 2003 12:48:10 GMT  
 Using VBScript to minimize, restore/maximize, close window

Quote:

>I would like use VBScript to do the equivilant of mouseclicking to
>minimize, maximize/restore or close a window in which I have
>made sendkey entries. I assume one procedure works for all windows
>with the minimize, restore/maximize, close button.

>set Shell = WScript.CreateObject("WScript.Shell")
>shell.run "notepad"  
>wscript.sleep(5000)
>shell.sendkeys("test")
>'>>> procedure to minimize, restore/maximize, close window

to maximize -

s.sendkeys "(% )X"

to minimize -

s.sendkeys "(% )N"

try pressing ALT-SPACE in any window for your other options

f



Sun, 12 Oct 2003 18:08:43 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using VBScript to minimize, restore/maximize or close a window

2. disabling minimize, maximize, restore buttons of an html popup window

3. How to hide the minimize, restore and close button on a maximized form

4. How to hide the maximize/restore and close-button on a maximized form

5. Hide Close, Minimize and Maximize at top of access window

6. Visual Basic - Trapping Minimize/Maximize/Close Events (from the window's buttons)

7. Window without maximize-, minimize- and close-button needed

8. API for hide the icons of maximize, minimize and close the window

9. maximize minimize restore

10. Minimize, Restore and Maximize

11. Minimize/Maximize/Restore equivalent to WM_CLOSE?

12. Window Refreshing When Using Minimize And Maximize

 

 
Powered by phpBB® Forum Software