Skip to content

Instantly share code, notes, and snippets.

@davebrny
davebrny / text wrap.ahk
Last active March 3, 2024 11:50
📇 (autohotkey) - wrap selected text in *symbols*
/*
[script info]
version = 2.5
description = wrap selected text in %symbols%
author = davebrny
source = https://gist.github.com/davebrny/088c48d6678617876b34f53571e92ee6
*/
sendMode input
return ; end of auto-execute
@davebrny
davebrny / [square tag].ahk
Last active February 21, 2024 08:35
🏷️ (autohotkey) - add a tagspaces style [tag] to a filename
/*
[tag list]
bank
car
insurance
receipt
tax
[settings]
recent_total = 11
@davebrny
davebrny / txt.wrap.ahk
Last active February 18, 2024 12:29
✏️ (autohotkey) - wrap selected text in *symbols*
/*
[wrap list]
( = (TXT)
`[ = [TXT]
{ = {TXT}
< = <TXT>
> = >TXT<
a = /`*TXT*`/
h = <!-- TXT -->
@davebrny
davebrny / txt.replace.ahk
Last active January 11, 2024 07:23
(autohotkey) - replace a character with another, interactively
#noEnv
#singleInstance, force
sendMode input
return ; end of auto-execute ---------------------------------------------------
!r:: goSub, txt_replace
!+r::goSub, use_last_replace
@davebrny
davebrny / txt.swap.ahk
Last active January 11, 2024 07:23
(autohotkey) - swap text at a certain character or word, interactively
#noEnv
#singleInstance, force
sendMode input
return ; end of auto-execute ---------------------------------------------------
!s:: goSub, text_swap
!+s::goSub, repeat_last_swap
; !+s::goSub, repeat_last_swap_interactive
@davebrny
davebrny / xywh.ahk
Last active November 3, 2023 22:10
(autohotkey) gui function that remembers the previously used x/y/w/h value
xywh(x:="", y:="", w:="", h:="") {
return value("x", x) . value("y", y) . value("w", w) . value("h", h)
}
value(letter, v) {
static prev_x, prev_y, prev_w, prev_h
if v contains +,-
v := eval(prev_%letter% . v)
@davebrny
davebrny / get_selected.ahk
Created November 13, 2017 10:37
(autohotkey) - gets selected text (or path of selected file/folder)
get_selected(wait_time="0.3") {
revert_clipboard := clipboardAll
clipboard := "" ; clear first
send ^{c}
clipWait, % wait_time
selected := clipboard
clipboard := revert_clipboard
return selected
@davebrny
davebrny / lightshot+.ahk
Last active October 25, 2023 13:06
(autohotkey) - improvements for lightshot (screenshot tool)
/*
[folders]
folder_1=
folder_2=
folder_3=
[settings]
prefix = LS_
time_format = yyyyMMddhhmmss
fullscreen_hotkey =
@davebrny
davebrny / close window f.ahk
Last active October 13, 2023 14:02
(autohotkey) - close a window then try more forceful methods if the window still exists
#noEnv
#persistent
#singleInstance, force
close_types := "winClose | postMessage | winKill | process"
hotkey, !F4, close_window_f
; hotkey, #q, close_window_f
return ; end of auto-execute ---------------------------------------------------
@davebrny
davebrny / - all script settings.ahk
Last active August 27, 2023 08:01
📜 (autohotkey) - script settings to be included in your main script or just used as a quick reference
; name ; options (* means default) ; description
; ------------------------------ ; -------------------------------- ; ---------------------------------------------------------
; #ClipboardTimeout -1 ; -1|0|1000* (Milliseconds) ; Changes how long the script keeps trying to access the clipboard when the first attempt fails
; #CommentFlag ; NewString ; Changes the script's comment symbol from semicolon to some other string
; #ErrorStdOut ; ; Sends any syntax error that prevents a script from launching to stderr rather than displaying a dialog
; #EscapeChar ; NewChar ; Changes the script's escape character (e.g. accent vs. backslash)
; #HotkeyInterval ; 2000* (Milliseconds) ; Along with #MaxHotkeysPerInterval, specifies the rate of hotkey activations beyond which a warning dialog will be displayed
; #H