Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / python_termux.tsk.xml
Created June 13, 2022 22:58
(tasker) a task that runs the termux plugin and termux-relay.py
<TaskerData sr="" dvi="1" tv="5.15.14">
<Task sr="task775">
<cdate>1653984629316</cdate>
<edate>1655136097308</edate>
<id>775</id>
<nme>python termux &gt;</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>547</code>
<label>set par1</label>
@davebrny
davebrny / termux-relay.py
Created June 13, 2022 16:13
(python, termux) run python scripts outside of the .termux/tasker folder
#!/data/data/com.termux/files/usr/bin/python
import sys
import subprocess
file = sys.argv[1]
args = ' '.join(map(str, sys.argv[2:]))
subprocess.run(['python', file, args])
@davebrny
davebrny / button-bixby-double.prf.xml
Created December 20, 2020 00:21
(tasker) bixby button remapping
<TaskerData sr="" dvi="1" tv="5.10.1">
<Profile sr="prof550" ve="2">
<cdate>1576780136016</cdate>
<cldm>3</cldm>
<clp>true</clp>
<edate>1608422876984</edate>
<flags>8</flags>
<id>550</id>
<mid0>545</mid0>
<nme>button - bixby double</nme>
@davebrny
davebrny / text launcher.ahk
Last active March 14, 2022 14:03
(autohotkey) - launch files/folders/urls from a text list
#noEnv
#singleInstance, force
sendMode, input
return
!l:: goSub, get_text_to_launch
!+l::goSub, text_launcher ; repeat last selection
@davebrny
davebrny / orbv.ahk
Created July 5, 2019 08:09
(autohotkey) - one-liners to restore built-in variables
^!b::
if (orb_list = "")
{
orb_list =
(lTrim
autoTrim | autoTrim | "off"
batchLines | setBatchLines | -1
controlDelay | setControlDelay | -1
coordModeCaret | coordMode, caret | "client"
coordModeMenu | coordMode, mouse | "client"
@davebrny
davebrny / run in Wine.py
Last active June 27, 2019 20:00
(autokey) - select a file to run in Wine
import getpass
import os.path
import subprocess
keyboard.send_keys("<ctrl>+c")
time.sleep(0.2)
str = clipboard.get_clipboard()
if "/.wine/" not in str: # if path is a native linux folder
user = getpass.getuser()
@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 / i.mage.ahk
Last active July 27, 2023 16:25
🧙‍♂️ (autohotkey) - one click image download
/*
[hotkeys]
!p = C:\Users\%a_userName%\Pictures\.i.mages
[browser]
ahk_exe chrome.exe
ahk_exe firefox.exe
ahk_exe iexplore.exe
ahk_exe vivaldi.exe