
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