Autohotkey

AutoHotKey #

Sample script:

; remove newline characters
; Win + X
#x::
  Send ^x
  StringReplace, clipboard, clipboard,`r`n,, All
  Send ^v
return

; google search highlighted words
^+s::
{
 Send, ^c
 Sleep 50
 Run, http://www.google.com/search?q=%clipboard%
 Return
}

; Open Downloads folder
#+d::Run "C:\Users\yunch\Downloads" ; ctrl+shift+d
return

; Open Google Drive folder
#+g::Run "C:\Users\yunch\Google Drive" ; ctrl+shift+d
return

; Open Windows Terminal
#+t::Run "C:\Users\yunch\Desktop\Windows Terminal.lnk" ; ctrl+shift+d
return

; Open MS To DO
#+i::Run "C:\Users\yunch\Desktop\Microsoft To Do.lnk" ; ctrl+shift+d
return

::btw::by the way
:*::as::中研院
  • To run this script, create a shortcut: doc
  • To expand Chinese characters, edit the script in Notepad.exe and save with UTF8 with BOM
  • To run Windows app program
    1. go to run.exe
    2. Open shell:AppsFolder
    3. Find the Windows app
    4. Create a shortcut to Desktop and run the shortcut in ahk script

Conditional hotkey for certain app #

Right-click the AutoHotkey icon in the taskbar and select AutoHotkey’s Window Spy to find the ahk_class of the programs you wish to manipulate.

This disables ctrl-e for Windows Terminal:

^e::
    if !WinActive("ahk_class", CASCADIA_HOSTING_WINDOW_CLASS){
      send {end}
    }
return

Reference #

Calendar Last modified: May 12, 2020