Friday, September 03, 2010

Playing with AutoHotKey

After reading so much about AutoHotKey I decided to take the plunge and tackle one of my annoying manual tasks - toggling the text and background colors in Firefox from normal to my most coveted, easy on the eyes, "white-on-black" theme.
screen shot
With AutoHotKeys handy recorder I saved this script to c:\home\mfincher\bin\toggleff.ahk:
Send, {ALTDOWN}{ALTUP}to
WinWait, Options, 
IfWinNotActive, Options, , WinActivate, Options, 
WinWaitActive, Options, 
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}
WinWait, Colors, 
IfWinNotActive, Colors, , WinActivate, Colors, 
WinWaitActive, Colors, 
Send, {TAB}{TAB}{SPACE}{TAB}{TAB}{TAB}{TAB}{SPACE}{TAB}{ENTER}
WinWait, Options, 
IfWinNotActive, Options, , WinActivate, Options, 
WinWaitActive, Options, 
Send, {TAB}{TAB}{ENTER}
Then in "My Documents\AutoHotkey.ahk" startup script created a mapping for "Windows-f" to run my script:
#f::Run c:\home\mfincher\bin\toggleff.ahk
Now if Firefox is the active window, and the Options panel has "Content" preselected I can just enter "Windows-f" and my colors are toggled.
Next, how to auto select Firefox and set the Options tab to be "Content".
Cheers.

No comments: