giovedì, ottobre 29, 2009

Using VBScript to Minimize, Restore, Maximize, and Close Windows

A useful code snippet courtesy of Google Groups:

 

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