vbscript - How can I maximize, restore, or minimize a window with a vb script? -


i need able make separte .vbs files (when triggered keyboard short-cut) make active window maximized, minimized, or restored.

how can without downloading , installing (not allowed here) separate package.

vbscript , windows script host don't provide intrinsic functions maximizing/minimizing/restoring window. without third-party tools, option use sendkeys simulate keyboard shortcuts of corresponding commands in window's system menu.

  • to maximixe active window, can simulate alt+spacebar, x shortcut:

    set oshell = createobject("wscript.shell") oshell.sendkeys "% x" 
  • to minimize active window, use alt+spacebar, n:

    set oshell = createobject("wscript.shell") oshell.sendkeys "% n" 
  • to restore active window, use alt+spacebar, r:

    set oshell = createobject("wscript.shell") oshell.sendkeys "% r" 

(note code won't work in non-english windows versions, names of maximize/minimize/restore commands localized , therefore have other shortcuts.)


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -