Practical AutoHotkey: AutoHotkey examples
This is the list of all examples from Practical AutoHotkey: How to get faster at work with text expansion and automation., which is available for sale on Amazon.com.
F1::MsgBox Hello, AutoHotkey! ; Example 1
F2::MsgBox Hello, AutoHotkey! ; Example 2
; Example 3 ^F5::reload +F5::edit F2::MsgBox Hello, AutoHotkey!
::hw::Hello World! ; Example 4
::hw::Hello World{!} ; Example 5:*:hi::Hi, I'm expanding this text using AutoHotkey and doing so RIGHT AWAY{!} ; Example 6:?:hi::Hi, I'm gonna expand *even in the middle of a word*{!} ; Example 7:?*:hi::Hello{!} I'm going to expand no matter what{!} ; Example 8; Example 9 (date) ::td:: SendInput %A_YYYY%-%A_MM%-%A_DD% return
; Example 10 (date, American style) ::tdamerica:: SendInput %A_MM%/%A_DD%/%A_YYYY% return
; Example 11 (date, 24-hr time) ::tdn:: SendInput %A_YYYY%-%A_MM%-%A_DD% %A_Hour%:%A_Min% return
; Example 12 (date, am/pm time) ::tdap:: FormatTime, now,, yyyy-M-d hh:mm tt SendInput %now% return
; Example 13
::multiline::
{
SendInput One line of text.{Enter}
SendInput {Tab}Another line of{ASC 0151}indented{ASC 0151}text.
}
return
; Example 14 ::multiline:: ( one line second line look ma, no variable ) return
; Example 15 var = ( This is the first line of my text. This is the second line of my text. ) ; ... many lines of my program .. ::multiline:: SendInput %var% return
:*:copyrr::{ASC 0169} ; Example 16: 'copyrr' turns into ©.:*:---::{ASC 0151} ; Example 17: triple dash sends em dash!>::SendInput {U+2265} ; Example 18: alt > sends greater-than-or-equal-toCapslock::Send {Media_Play_Pause} ; Example 19Capslock::Ctrl ; remap CapsLock to Ctrl, Example 20
AppsKey::Capslock ; retain ability to use CapsLock via the key between RAlt and RCtrl, Example 21
F12::Capslock ; retain ability to use CapsLock - press F12 to toggle Caps Lock on and off, Example 22
#w::run https://weather.com/ ; Example 23
#n::run notepad.exe ; Example 24
; Example 25 #F3:: Input Key,L1 if Key=m run chrome.exe https://www.lynda.com/learning-paths/Marketing/become-a-content-marketer else if Key=p run chrome.exe https://www.lynda.com/learning-paths/Business/become-a-project-coordinator return
; Example 26 !#s::run https://workflowy.com/#/1234567890
; Example 27
SetTitleMatchMode 2 ;; window's title can contain WinTitle anywhere inside to match
;; DetectHiddenWindows, on ;; Uncomment if you uncomment WinHide, below, so we can find the window after we hide it.
F12::
{
IfWinActive, Notepad
{
WinMinimize, Notepad
;; WinHide, Notepad ;; uncomment this line if you want the window to disappear, including from the Windows taskbar.
WinActivate,%previous_window%
}
else
{
WinGetActiveTitle,previous_window
WinActivate,Notepad
}
}
return
; Example 28
F12::
{
SetTitleMatchMode 2 ; in case you hadn't already declared it
DetectHiddenWindows, On
ifWinExist, <you@your-company.com> - Outlook
{
ifWinNotActive, <you@your-company.com> - Outlook
{
WinShow, <you@your-company.com> - Outlook
WinActivate, <you@your-company.com> - Outlook
}
else
{
WinMinimize, <you@your-company.com> - Outlook
WinHide, <you@your-company.com> - Outlook
}
}
else
Run Outlook.exe
}
return
</you@your-company.com></you@your-company.com></you@your-company.com></you@your-company.com></you@your-company.com></you@your-company.com>; Example 29 ::eml::<your-email@your-company.com> ::peml::<your-personal-e-mail@your-provider.com> ::ph::<123-ur-phone#> ::cph::<456-ur-cellphone#> </your-personal-e-mail@your-provider.com></your-email@your-company.com>
; Example 30 #P::run https://really-long-and-stupid-url-for-purchasing-system-I-can-never-remember
This is the list of all examples from Practical AutoHotkey: How to get faster at work with text expansion and automation., which is available for sale on Amazon.com.