Skip to content

Instantly share code, notes, and snippets.

@db93n2
db93n2 / msgbox check.ahk
Last active November 13, 2017 21:48
(autohotkey) - check the text in a msgbox for trailing characters
~RButton::
mouseGetPos, cursor_x, cursor_y, , control_under_cursor
if winActive("ahk_exe AutoHotkey.exe") and winActive("ahk_class #32770")
and (control_under_cursor = "Button1") ;# if msgBox window
{
winGetText, msg_text, a
loop
{ ; remove button text
controlGetText, button_text, % "button" a_index, a
@db93n2
db93n2 / tray menu defaults.ahk
Last active October 3, 2019 14:48
(autohotkey) - default items for the tray menu
; default items for the tray menu
tray_open:
listLines
return
tray_help:
splitpath, a_ahkPath, , ahk_dir
run, % ahk_dir "\AutoHotkey.chm"
@db93n2
db93n2 / ordinal.ahk
Last active August 10, 2022 20:12
(autohotkey) - add an ordinal suffix to a number: 1st, 2nd, 3rd
ordinal(number) {
stringRight, last_digit, number, 1
stringRight, last_two , number, 2
if (last_digit = 1)
suffix := "st"
else if (last_digit = 2)
suffix := "nd"
else if (last_digit = 3)
suffix := "rd"
@db93n2
db93n2 / quick dates.ahk
Last active March 13, 2018 12:27
📆 (autohotkey) - hotstrings to quickly type various date formats
#noEnv
#singleInstance, force
sendMode, input
; #hotstring * ; send each hotstring without needing to type an endkey (space, enter etc)
sp := a_space ; send a space after each hotstring
return ; -----------------------------------------------------------------------
@db93n2
db93n2 / auto_include.ahk
Last active January 19, 2023 03:10
📃 (autohotkey) - create a list of .ahk files to be #included in your main script
/*
[search folders]
folder_1 =
folder_2 =
[ignore paths]
C:\Users\documents\scripts\example script name.ahk
C:\Users\documents\scripts\example folder name
[settings]
@db93n2
db93n2 / randomer.ahk
Last active November 13, 2017 16:09
(autohotkey) - the default random command but without returning the same number twice in a row
randomer(min="", max="") {
static last_random
loop,
random, this_random, % min, % max
until (this_random != last_random)
last_random := this_random
return this_random
}
@db93n2
db93n2 / built_in.ahk
Last active August 11, 2019 22:45
(autohotkey) - change, restore or reset various built-in script settings
/*
[built-in defaults]
a_autoTrim = on
a_batchLines = 10ms
a_controlDelay = 20
a_coordModeCaret = screen
a_coordModeMenu = screen
a_coordModeMouse = screen
a_coordModePixel = screen
a_coordModeToolTip = screen
@db93n2
db93n2 / root url.ahk
Last active February 26, 2018 18:31
(autohotkey) - load the root url of the current webpage
#if WinActive("ahk_class Chrome_WidgetWin_1") ; chrome
or WinActive("ahk_class MozillaWindowClass") ; firefox
!r::goSub, root_url
#if
root_url:
revert_clipboard := clipboardAll
@db93n2
db93n2 / google search time range.ahk
Last active April 2, 2023 04:05
(autohotkey) - switch between the various time ranges (hour, day, week, month, year) 🔎
#if WinActive("ahk_class Chrome_WidgetWin_1", , "ahk_class #32770")
or WinActive("ahk_class MozillaWindowClass", , "ahk_class #32770")
^+l::goSub, google_time_range
#if
google_time_range:
@db93n2
db93n2 / start_with_windows.ahk
Last active November 13, 2017 12:22
🚩 (autohotkey) - tray option to start your scripts when windows starts
start_with_windows(seperator="", menu_name="tray") {
global sww_shortcut, sww_menu
sww_menu := menu_name
if (seperator = "1") or (seperator = "3")
menu, % sww_menu, add,
menu, % sww_menu, add, Start with Windows, start_with_windows
splitPath, a_scriptFullPath, , , , script_name
sww_shortcut := a_startup "\" script_name ".lnk"