Help for window management

Commands and keywords to manage the active window.

Quick Tip: Windows management keywords using the commands below, can be imported by typing the following in Executor -i executor.dk/windowkeywords.exc

Some notes:

  • Parameters for these commands can either be send from the input when using the keyword, or be defined in the parameter part of a keyword using the window command, or when called by another keyword command.
  • You can rename the keywords to your liking, or create your own.
  • Keep in mind some apps have minimum and maximum sizes build into the app.

Commands and keywords

Command: $WCLOSE$, $WOPEN$
Keywords: close, open
parameters: none
Close or open the current active window. Close is most handy to quickly close the last active window from within Executor, or by binding a hotkey, or linking it to another keyword.

Command: $WMAXIMIZE$, $WMINIMIZE$, $WRESTORE$
Keywords: minimize, maximize, restore
parameters: none
Minimize or maximize the current active window. Restore will restore the window to it's original size if you used minimize or maximize.

Command: $WMAXWIDTH$, $WMAXHEIGHT$
Keywords: width, height
parameters: none
Maximize the width or height of the active window on the screen it's currently located.

Command: $WCENTER$
Keyword: center
parameters: [screen-num(optional)]
Center the current active window on the screen it's currently located, or at a specific screen (display).

center // center on the current screen of the window.
center 2 // center on screen number 2

Command: $WLEFT$, $WRIGHT$,$WTOP$, $WBOTTOM$
Keywords: left, right, top, bottom
parameters: [size-in-percent(opt)],[screen-num(opt)]
note: Setting [size-in-percent] to 0 or n will keep same size. You can use pixels instead of the default percentage by adding px
Align the active window to the left, right, top, bottom of the screen. Optionally also define how many percentage of the screen the window should use, and which screen.

left // Move active window to the left on it's current screen
left 50 // Move active window to the left on it's current screen and window width will be 50% of the screen width
left 0,2 // Keep current window size and move active window to the left on screen number 2
left n,2 // Keep current window size and move active window to the left on screen number 2
left 200px,2 // Resize window to 200 pixels (instead of the default percentage), and move active window to the left on screen number 2
left 50,2 // Move active window to the left on screen number 2, and window width will be 50% of screen number 2 width
bottom 50,1 // Move active window to the bottom of screen number 1, and window height will be 50% of screen number 1 height

Command: $WARRANGE$, $WRESIZE$
Keywords: arrange, resize
parameters: [width],[height(opt)],[left(opt)],[top(opt)],[screen-num(opt)]
parameters if containing "center": [width],[height],center,[screen-num(opt)]
note: Setting [width], [height], [left] or [top] to n will keep the original value. You can use percentage instead of the default pixels by adding %
Set/Get the position and/or size, and which screen to use. Also supports using pixels and percentages. The two commands does the same (legacy support).

arrange // get the current width,height,left,top,screen values
arrange 500 // change width to 500 pixel
arrange 50% // change width to 50 percent of the width of the screen where it's located
arrange 800,600 // change the width to 800 pixel and height to 600 pixel    
arrange n,600 // don't change the width, and change height to 600 pixel
arrange 800,50%,200,300 // change the width to 800 pixel and height to 50 percent of the current screen, and set window left position to 200 pixels, and window top position to 300 pixels, on current screen
arrange n,n,200,0 // don't change window size, and set window left position to 200 pixels, and 0 pixels to the top on current screen    
arrange n,n,200,n // don't change window size, and set window left position to 200 pixels, and no change to the top position on current screen    
arrange n,n,200,0,2 // don't change window size, and set window left position to 200 pixels, and 0 pixels to the top, on screen number 2
arrange 33%,33%,33%,33%,2 // change width and height to 33 percent of screen number 2, and set window left at 33 percent of the width- and top at 33 percent of the height of screen number 2. Also move window to screen 2
arrange 800,600,center //  change the width to 800 pixel and height to 600 pixels, and center window on it's current screen
arrange 80%,60%,center,2 //  change the width to 80 percent and height to 60 percent of screen number 2, and center window on screen number 2

Command: $WEXECUTOR$
Keywords: xarrange
Set/Get the Executor window position and size, uses the same syntax as $WARRANGE$, see above.

Command: $WADJUST$
Keyword: adjust
parameters: [width],[height(opt)],[left(opt)],[top(opt)],[screen-num(opt)]
Adjust the window size and position by adding or subtracting pixels.

adjust 50 // make the window 50 pixels wider
adjust 50,100 // make the window 50 pixels wider and 100 pixels higher
adjust -50,-100 // decrease window width by 50 pixels and decrease height by 100 pixels
adjust 0,-100 // keep same width and decrease height by 100 pixels
adjust 50,100,-50,-100 // make the window 50 pixels wider and 100 pixels higher, move it 50 pixels to the left and 100 pixels up    
adjust 50,100, 50,100 // make the window 50 pixels wider and 100 pixels higher, move it 50 pixels to the right and 100 pixels down    
adjust 50,100,50,100,2 // make the window 50 pixels wider and 100 pixels higher, move it 50 pixels to the right and 100 pixels down, and move it to screen 2

Command: $WINFO$
Keyword: winfo
parameters: self(opt) or [handle(opt)]
Get information about the current active window. For example the title, class and handle of the window, and any child windows. can also take window handle as parameter, or the word "self" for Executors window.

winfo // get info from current active window
winfo 21245 // get info from the window with the handle 21245
winfo self // get info from Executors window

Command: $WHANDLE$
Keyword: whandle
parameters: [handle]
Open a window by it's handle-id, This is more meant for trouble-shooting if fiddling with windows.

whandle 83151 // open the window with the handle id 83151

Command: $WFINDACTIVE$...$WFINDACTIVE$
Open a window (or all windows) by it's title or class. In case the window don't exist an optional alternative command can be run instead.
This is a block to be inserted into a keywords command field. In case the window doesn't exist the rest of the command field (if any) will be executed instead. Though with some limitations that it cannot be another keyword, and limited support for other commands.

  • Per default window title will be used as a "starts-with" search.
  • Add class, to use window class instead of window title.
  • Add file, to use window file path of the executable.
  • Add sub, if you rather do a substring search instead of "starts-with" search.
  • Add all, if it should not only effect the top most window matching window, but all matching windows.
  • Order matters, so class,sub,all, if for example using all parameters.
  • Also this is not case sensitive.
Here are some examples of use within a keywords command field:

$WFINDACTIVE$notepad$WFINDACTIVE$ // open window where title starts with "notepad" 
$WFINDACTIVE$notepad$WFINDACTIVE$C:\Windows\System32\notepad.exe // open window where title starts with "notepad", if no window is found then run C:\Windows\System32\notepad.exe
$WFINDACTIVE$class,notepad$WFINDACTIVE$ // open window where class starts with "notepad" 
$WFINDACTIVE$sub,otepad$WFINDACTIVE$ // open window where title contains "otepad" 
$WFINDACTIVE$sub,all,otepad$WFINDACTIVE$ // open all windows where title contains "otepad" 
$WFINDACTIVE$file,sub,otepad.exe$WFINDACTIVE$ // open all windows where file path of the window executable contains "otepad.exe" 
$WFINDACTIVE$class,sub,otepad$WFINDACTIVE$ // open window where class contains "otepad" 
$WFINDACTIVE$class,sub,otepad$WFINDACTIVE$C:\Windows\System32\notepad.exe // open window where class contains "otepad", if no window is found then run C:\Windows\System32\notepad.exe

Command: $WFINDCLOSE$...$WFINDCLOSE$
Close a window (or all windows) by it's title or class. In case the window don't exist an optional alternative command can be run instead. See $WFINDACTIVE$ for how to use and syntax (it's the same, but just closing instead of opening).

Advanced usage

  • Being creative with keywords using multiple commands. Example: a keyword that always sets a window in top left corner of main screen at a 50 percent width and height. New keyword.name = topleftmain keyword.command = top 50,1||left 50,1 it is depended on the keywords top and left.
    Lets make a keyword that sets active window in top left corner without changing window size, and takes the screen-number as a parameter, keyword.name = topleftscreen keyword.command = top 0,$P$||left 0,$P$. Now typing topleftscreen 2 will position the last active window at top left corner on screen 2.

More Resources & Community