Skip to content

Instantly share code, notes, and snippets.

@anthonybaldwin
Created June 23, 2019 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonybaldwin/09df8c1efafeac5d9d6217ea82f4fe46 to your computer and use it in GitHub Desktop.
Save anthonybaldwin/09df8c1efafeac5d9d6217ea82f4fe46 to your computer and use it in GitHub Desktop.
AHK Blank Template by GroggyOtter
;Blank Template written by GroggyOtter
;============================== Start Auto-Execution Section ==============================
; Always run as admin
if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
; Keeps script permanently running
#Persistent
; Determines how fast a script will run (affects CPU utilization).
; The value -1 means the script will run at it's max speed possible.
SetBatchLines, -1
; Avoids checking empty variables to see if they are environment variables.
; Recommended for performance and compatibility with future AutoHotkey releases.
#NoEnv
; Ensures that there is only a single instance of this script running.
#SingleInstance, Force
; Makes a script unconditionally use its own folder as its working directory.
; Ensures a consistent starting directory.
SetWorkingDir %A_ScriptDir%
; sets title matching to search for "containing" instead of "exact"
SetTitleMatchMode, 2
GroupAdd, saveReload, %A_ScriptName%
return
;============================== Save Reload / Quick Stop ==============================
#IfWinActive, ahk_group saveReload
; Use Control+S to save your script and reload it at the same time.
~^s::
TrayTip, Reloading updated script, %A_ScriptName%
SetTimer, RemoveTrayTip, 1500
Sleep, 1750
Reload
return
; Removes any popped up tray tips.
RemoveTrayTip:
SetTimer, RemoveTrayTip, Off
TrayTip
return
; Hard exit that just closes the script
^Esc::
ExitApp
#IfWinActive
;============================== Main Script ==============================
; Your main code here.
; Global hotkeys
; Global hotstrings
; etc...
;============================== Program 1 ==============================
; Evertything between here and the next #IfWinActive will ONLY work in someProgram.exe
; This is called being "context sensitive"
; #IfWinActive, ahk_exe someProgram.exe
; #IfWinActive
;============================== ini Section ==============================
; Do not remove /* or */ from this section. Only modify if you're
; storing values to this file that need to be permanantly saved.
/*
[SavedVariables]
Key=Value
*/
;============================== GroggyOtter ==============================
;============================== End Script ==============================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment