Created
July 5, 2019 08:09
-
-
Save db93n2/225f5b37fe646c4cfe8c7d65174cbe4d to your computer and use it in GitHub Desktop.
(autohotkey) - one-liners to restore built-in variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^!b:: | |
if (orb_list = "") | |
{ | |
orb_list = | |
(lTrim | |
autoTrim | autoTrim | "off" | |
batchLines | setBatchLines | -1 | |
controlDelay | setControlDelay | -1 | |
coordModeCaret | coordMode, caret | "client" | |
coordModeMenu | coordMode, mouse | "client" | |
coordModeMouse | coordMode, mouse | "client" | |
coordModePixel | coordMode, pixel | "client" | |
coordModeToolTip | coordMode, toolTip | "client" | |
defaultMouseSpeed | setDefaultMouseSpeed | 0 | |
detectHiddenText | detectHiddenText | "on" | |
detectHiddenWindows | detectHiddenWindows | "on" | |
isCritical | isCritical | "off" | |
sendMode | sendMode | "input" | |
stringCaseSense | stringCaseSense | "on" | |
titleMatchMode | setTitleMatchMode | 2 | |
titleMatchModeSpeed | setTitleMatchMode | "slow" | |
winDelay | setWinDelay | -1 | |
workingDir | setWorkingDir | a_scriptDir | |
) | |
loop, parse, orb_list, `n | |
{ | |
orb := strSplit(a_loopField, "|", a_space) | |
menu, orb_menu, add, % orb[1], orb_menu_action | |
} | |
} | |
if (orb_list) | |
menu, orb_menu, show | |
return | |
orb_menu_action: | |
stringGetPos, orb_pos, % orb_list, % a_thisMenuItem, L1 | |
stringMid, orb_output, % orb_list, orb_pos + 1 | |
stringGetPos, orb_pos, % orb_output, `n, L1 | |
stringMid, orb_line, % orb_output, orb_pos, , L | |
orb := strSplit(orb_line, "|", a_space) | |
; make acronym from item name | |
orb_acrnm := subStr(a_thisMenuItem, 1, 1) | |
loop, parse, a_thisMenuItem | |
{ | |
if a_loopField is upper | |
orb_acrnm .= a_loopField | |
} | |
stringLower, orb_acrnm, orb_acrnm | |
if a_thisMenuItem contains coordModeMenu,winDelay | |
orb_acrnm .= "e" | |
; paste line 1, add line 2 to the clipboard | |
sendMode, % ("input"), restore_sm := a_sendMode | |
clipboard := orb[2] ", % (" orb[3] "), restore_" orb_acrnm " := a_" a_thisMenuItem | |
send ^{v} | |
sleep 100 | |
clipboard := orb[2] ", % restore_" orb_acrnm | |
sendMode, % restore_sm | |
return | |
/* | |
[script info] | |
version = 1 | |
description = one-liners to restore built-in variables | |
author = davebrny | |
source = https://gist.github.com/davebrny/225f5b37fe646c4cfe8c7d65174cbe4d | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage
example in use: