2013-06-08

Productivity and workflow improvements in a Windows environment

Today I decided that I should focus on improving my workflow by teaching myself some windows keyboard short keys similar to Win+E, Win+D, Win+R.

On Microsoft's support site they have a pretty updated and complete version of what keyboard shortcuts that exists and what they do and it taught me a couple of cool tricks. The most amazing one is definitely WIN + arrow keys.

What these macros do is that they resize/realign the current active window in many different ways. Left and Right aligns the window to the screen(s) and makes it possible to get items that are outside of displays to be moved into view again (OH BOY, FINALLY!!!). This also makes it easier to align windows next to one other since the window when moved snaps to the edges of the display. The Up and Down buttons are used to maximize/restore/minimize the current active window. Here I have only found use for Maximize/Restore-functionality.

Two other cool thing that I didn't know about prior to today is that:

  • alt+ print screen screen captures only current active window to clipboard
  • win+[1-9] starts/activates the program in the respective "pinned to taskbar"-slot
What I really was searching for today though, is functionality to minimize the current active window. It turns out that this was pretty easy by pressing alt+space+n/m (depending on OS-language). Unfortunately this wasn't really what I wanted and hence the search continued. 

And it didn't take long before I ran into an amazing program called AutoHotkey which makes it possible to pretty much rebind any input in Windows to do whatever you want. And it can also generate other keypresses/mousepresses for you depending on what you tell it to do.

It took me a while to get into the syntax and flow of the program but after just an hour I got it to do a much better minimize functionality than what was offered by stock windows. 

My version of minimize stores last minimized window and any additional click during a certain timeframe on that shortkey will restore the last minimized window. Next thing to use AutoHotkey for, is to make it generate boilerplate code for me whenever pressed :) (Also, I made win+c start calculator by writing #c:: Run calc.exe).

Link to AutoHotkey and here's the code to minimize/restore a window:


#SingleInstance force

time_before_reset := 1000
title := "foobar"
press_counter := 0

#m::
if press_counter = 0
{
WinGetTitle, title, A
WinMinimize,%title%
;MsgBox Minimizing %title%
press_counter := 1
SetTimer, reset_state, %time_before_reset%
return
} else {
;MsgBox Maximizing %title%
WinRestore, %title%
Gosub, reset_state
return
}

reset_state:
SetTimer, reset_state, off
press_counter := 0
return