{"id":7781,"date":"2018-04-18T14:22:07","date_gmt":"2018-04-18T21:22:07","guid":{"rendered":"https:\/\/www.lee.org\/blog\/?p=7781"},"modified":"2018-05-17T14:33:10","modified_gmt":"2018-05-17T21:33:10","slug":"autohotkey-is-so-useful","status":"publish","type":"post","link":"https:\/\/www.lee.org\/blog\/2018\/04\/18\/autohotkey-is-so-useful\/","title":{"rendered":"Autohotkey Is So Useful"},"content":{"rendered":"<p><strong>Autohotkey is mind bogglingly useful<\/strong>! Autohotkey is a free, open source Windows program that lets you do simple and complicated scripting with keyboard commands. I&#8217;ve been using it since about 2001. I use it a zillion times a day. I couldn&#8217;t imagine not having it.<\/p>\n<p>Some things you can do with it:<br \/>\n&#8211; Have a second copy-paste clipboard<br \/>\n&#8211; Do a &#8220;paste&#8221; and strip out the formatting<br \/>\n&#8211; type often used strings like addresses, phone numbers, and email signatures with just a few strokes.<br \/>\n&#8211; make a window on your computer to be always on top of the other windows<br \/>\n&#8211; start a favorite program (Chrome, Word, Calc, whatever) with a single keystroke<br \/>\n&#8211; Type today&#8217;s date with a single keystroke<\/p>\n<p>I&#8217;ve set it up to do about 50 commands. If you want to do things on the computer faster and easier, you might want to use it too. Just <a href=\"https:\/\/autohotkey.com\/\">download Autohotkey<\/a> \u00a0and put some of the scripts I have below in your setting file. There&#8217;s a bunch of ways to do that, <a href=\"https:\/\/autohotkey.com\/docs\/Tutorial.htm\">here is a tutorial<\/a>.<\/p>\n<p>Here is my settings file. Just look at the first line of each script to see what it does.<br \/>\n<!--more--><\/p>\n<p><code><br \/>\n; See the docs at the end of this file.<\/code><\/p>\n<p>^!i:: ; Run IEP Calendar with Ctrl-Alt-i<br \/>\nIfWinExist, IEP Calendar.xlsx<br \/>\nWinActivate<br \/>\nelse<br \/>\nRun, &#8220;C:\\aaa\\OT Work\\IEP Calendar.xlsx&#8221;<br \/>\nreturn<\/p>\n<p>^!s:: ; Run Scratch with Ctrl-Alt-s<br \/>\nIfWinExist, Scratch.docx<br \/>\nWinActivate<br \/>\nelse<br \/>\nRun, &#8220;C:\\aaa\\OT Work\\Scratch.docx&#8221;<br \/>\nreturn<\/p>\n<p>; Ctrl-Alt-v to paste text only; the formatted version remains in clipboard.<br \/>\n^!v:: ; paste stripping formatting   via https:\/\/autohotkey.com\/board\/topic\/10412-paste-plain-text-and-copycut\/<br \/>\n;                          remove white space and new line marks and that avoids &#8220;pasting&#8221; because that can trigger unnecessary paste options in Microsoft<br \/>\n  gosub getplain<br \/>\nclipboard:=clipboardt                          ; This works and does so quickly as long as &#8220;Ctrl-v&#8221; is used to paste<br \/>\nSend ^v<br \/>\n; Send {Raw}%clipboardt%                ; This works but it&#8217;s slow<br \/>\n; SendInput {Raw}%clipboardt%      ; This SHOULD work but it fucks shit up<br \/>\n clipboardt =<br \/>\n  return<\/p>\n<p>  getplain:<br \/>\n  StringReplace, clipboardt, clipboard, `r, %A_Space%, All      ; The `r strips out carriage return, `n strips out newlines.<br \/>\n  clipboardt := RegExReplace(clipboardt, &#8220;` {2,}&#8221;, &#8220;` &#8220;)<br \/>\n  StringLeft, 1st, clipboardt, 1<br \/>\n  IfInString, 1st, %A_Space%<br \/>\n  StringTrimLeft, clipboardt, clipboardt, 1<br \/>\n  StringRIght, last, clipboardt, 1<br \/>\n  IfInString, last, %A_Space%<br \/>\n  StringTrimRight, clipboardt, clipboardt, 1<br \/>\n  return<\/p>\n<p>; copy selected text to AutohotkeyClipboard<br \/>\n^!n::\t;Ctrl-Alt-n copy selected text to AutohotkeyClipboard<br \/>\n\toriginalclipboardcontents = %clipboardall%<br \/>\n\tclipboard =  ; Start off empty to allow ClipWait to detect when the text has arrived<br \/>\n\tSend ^c<br \/>\n\tclipwait ; wait for the clipboard to contain text<br \/>\n \tautohotkeyclipboard = %clipboard%                           ; Grab it, strip it, and shove it<br \/>\n\tclipboard = %originalclipboardcontents%    ; Restore original clipboard contents<br \/>\n;    \toriginalclipboardcontents =  ; Free up memory<br \/>\n\tReturn<\/p>\n<p>; paste text out of the AutohotkeyClipboard<br \/>\n^!m:: \t;Ctrl-Alt-m to paste from memory<br \/>\n\tSend %autohotkeyclipboard%{space}<br \/>\n\tReturn \t<\/p>\n<p>; hit ctrl-space to make the current window always on top. From http:\/\/www.labnol.org\/software\/tutorials\/keep-window-always-on-top\/5213\/<br \/>\n^SPACE:: Winset, Alwaysontop, , A<\/p>\n<p>^!d:: ; Run Chrome with Ctrl-Alt-d<br \/>\nIfWinExist, New Tab &#8211; Google Chrome ; If there is already a blank window, bring it to front.<br \/>\n{<br \/>\nWinActivate, New Tab &#8211; Google Chrome<br \/>\nControlFocus, Chrome_OmniboxView1<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nRun, chrome<br \/>\n; Run, &#8220;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&#8221;<br \/>\n; WinWaitActive, New Tab &#8211; Google Chrome, , 3 ; wait for for Chrome to open<br \/>\n;if ErrorLevel ; if Chrome doesn&#8217;t open within the timeframe, throw an error on the desktop<br \/>\n; {<br \/>\n; ; MsgBox, Chrome WinWait timed out.<br \/>\n; TrayTip, Autohotkey, Chrome WinWait timed out, 5<br \/>\n; WinActivate, New Tab &#8211; Google Chrome ; activate the chrome window<br \/>\n; return<br \/>\n; }<br \/>\nLoop 10 ; Let&#8217;s try pulling it up 10 times (Loop 10) waiting .2 seconds (sleep 200) to check and pull it up<br \/>\n{<br \/>\nSleep, 200 ; maybe this will help guarantee that it catches????????<br \/>\n; SoundPlay *-1<br \/>\nIfWinExist, New Tab &#8211; Google Chrome ; If there is already a blank window, bring it to front.<br \/>\n{<br \/>\nWinActivate, New Tab &#8211; Google Chrome<br \/>\nControlFocus, Chrome_OmniboxView1<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\nreturn<\/p>\n<p>; This script opens my favorite text editor. If it&#8217;s already open, it pulls it to the front. I use this a zillion times a day<br \/>\n; I made it Ctrl-Alt-e because it used to start Editpad&#8230; My fingers remember the &#8220;e&#8221; better than the &#8220;s&#8221;. Change it to whatever you like.<br \/>\n^!e:: ; Run SublimeText++ with Ctrl-Alt-e<br \/>\nIfWinExist, sublime_text.exe<br \/>\nWinActivate<br \/>\nelse<br \/>\nRun, &#8220;C:\\Program Files\\Sublime Text 3\\sublime_text.exe&#8221;<br \/>\nreturn<\/p>\n<p>; Start up my favorite calculator<br \/>\n^!c:: ; Run Calc with Ctrl-Alt-c<br \/>\nIfWinExist, Moffsoft FreeCalc<br \/>\nWinActivate<br \/>\nelse<br \/>\nRun, &#8220;C:\\Program Files (x86)\\Moffsoft FreeCalc\\MoffFreeCalc.exe&#8221;<br \/>\nreturn<\/p>\n<p>^!t:: ; Run Truecrypt with Ctrl-Alt-t<br \/>\nIfWinExist, TrueCrypt<br \/>\nWinActivate<br \/>\nelse<br \/>\nRun, &#8220;C:\\aaa\\pocketpc.tc&#8221;<br \/>\nreturn<\/p>\n<p>^!k:: ; Open Truecrypt k: with Ctrl-Alt-k<br \/>\nSetTitleMatchMode, 2 ; allow partial matches for WinExist<\/p>\n<p>If WinExist(&#8220;K:\\&#8221;,&#8221;Namespace Tree Control&#8221;) or WinExist(&#8220;&amp;crumb=location:K%3A&#8221;)<br \/>\n{<br \/>\nWinActivate<br \/>\nControlFocus, DirectUIHWND1<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nRun, explorer K:\\<br \/>\nControlFocus, DirectUIHWND1<br \/>\n}<br \/>\nreturn<\/p>\n<p>; I have a lot of &#8220;..&#8221; codes. Just type &#8220;.. and whatever&#8221; and the text appears.<br \/>\n; type &#8220;..sig&#8221; and my signature appears<br \/>\n:o:..sig::Thanks,{enter}Lee Sonko, OTR\/L{enter}Occupational Therapist{enter}<\/p>\n<p>:o:..ot::occupational therapist<br \/>\n:o:..pot::pediatric occupational therapist<\/p>\n<p>:o:..b::Berkeley<br \/>\n:o:..bc::Berkeley, CA<br \/>\n:o:..9::94706<\/p>\n<p>:o:..s::San Francisco<br \/>\n:o:..c:: California<\/p>\n<p>:0:..80::123456789012345678901234567890123456 &gt;40&lt; 3456789012345678901234567890123456 &gt;80{enter}<\/p>\n<p>:o:..-::{enter}&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;{up}<\/p>\n<p>:o:..=::=================================================={Right}<\/p>\n<p>; Here&#8217;s some old school message quoting. I don&#8217;t use this often. Try &#8220;..&lt;&#8221; when you are at the top of some text you want to do message quoting to. ; :o:.&gt;::{Home}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}&gt;{left}{down}{Enter}<\/p>\n<p>:o:.&lt;::{Home}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}&gt;{Right 76}{ctrl left}{Enter}<\/p>\n<p>; More message quoting. Try &#8220;..&gt;&#8221; then hit enter, then type a number from 1 to 99 and hit enter again<br \/>\n:o:.&gt;:: ; Perform message quoting&#8230; Give it 1-99 and it&#8217;ll quote that many lines.<br \/>\nInput,variable,L2,{Enter}<br \/>\nSetKeyDelay 0<br \/>\nBlockInput,on<br \/>\nSend {Home}<br \/>\nLoop, %variable%<br \/>\n{<br \/>\nSend &gt;{Right 78}{ctrldown}{left}{ctrlup}{Enter}<br \/>\n}<br \/>\nBlockInput,off<\/p>\n<p>:o:.p::&#8212;&#8212;&#8211; Page Break &#8212;&#8212;&#8212;&#8212;-{enter}<\/p>\n<p>:o:.ms::&#8212;&#8212;&#8211; Original Message &#8212;&#8212;&#8212;&#8212;-{enter}<\/p>\n<p>:o:.me::&#8212;&#8212;&#8211; End of Original Message &#8212;&#8212;{enter}<\/p>\n<p>:o:.ss::&#8212;- Start of Snippet &#8212;-{home}{down}<\/p>\n<p>:o:.se::&#8212;- End of Snippet &#8212;-{enter}<\/p>\n<p>:o:..d:: ; current date<br \/>\nFormatTime, CurrentDateTime,, M-d-yy ; It will look like 9-1-17<br \/>\nSetKeyDelay 0 ; This sets the keystrokes below to be sent faster than the default.<br \/>\nSend %CurrentDateTime%<br \/>\nSend {space}{enter}&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;{up}<br \/>\nreturn<\/p>\n<p>:o:..date:: ; This hotstring replaces &#8220;]d&#8221; with the current date and time.<br \/>\nFormatTime, CurrentDateTime,, M\/d\/yyyy h:mm tt ; It will look like 9\/1\/2005 3:53 PM<br \/>\nSetKeyDelay 0 ; This sets the keystrokes below to be sent faster than the default.<br \/>\nSend %CurrentDateTime%<br \/>\nreturn<\/p>\n<p>; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a<br \/>\n; semicolon, such as this one, are comments. They are not executed.<\/p>\n<p>; This script is a .INI file because it is a special script that is<br \/>\n; automatically launched when you run the program directly. By contrast,<br \/>\n; text files that end in .ahk are associated with the program, which<br \/>\n; means that they can be launched simply by double-clicking them.<br \/>\n; You can have as many .ahk files as you want, located in any folder.<br \/>\n; You can also run more than one .ahk file simultaneously and each will<br \/>\n; get its own tray icon.<\/p>\n<p>; Please read the QUICK-START TUTORIAL near the top of the help file.<br \/>\n; It explains how to perform common automation tasks such as sending<br \/>\n; keystrokes and mouse clicks. It also explains how to use hotkeys.<\/p>\n<p>; SAMPLE HOTKEYS: Below are two sample hotkeys. The first is Win+Z and it<br \/>\n; launches a web site in the default browser. The second is Control+Alt+N<br \/>\n; and it launches a new Notepad window (or activates an existing one). To<br \/>\n; try out these hotkeys, run AutoHotkey again, which will load this file.<\/p>\n<p>; Find Hotstring documentation here: http:\/\/www.autohotkey.com\/docs\/Hotstrings.htm<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Autohotkey is mind bogglingly useful! Autohotkey is a free, open source Windows program that lets you do simple and complicated scripting with keyboard commands. I&#8217;ve been using it since about 2001. I use it a zillion times a day. I couldn&#8217;t imagine not having it. Some things you can do with it: &#8211; Have a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,14],"tags":[],"class_list":["post-7781","post","type-post","status-publish","format-standard","hentry","category-geekery","category-product-recommendations"],"_links":{"self":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts\/7781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/comments?post=7781"}],"version-history":[{"count":0,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts\/7781\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/media?parent=7781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/categories?post=7781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/tags?post=7781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}