Skip to content

Instantly share code, notes, and snippets.

@davebrny
Last active August 11, 2019 22:45
Show Gist options
  • Save davebrny/02167ebb09cedfb922f875917c23b26b to your computer and use it in GitHub Desktop.
Save davebrny/02167ebb09cedfb922f875917c23b26b to your computer and use it in GitHub Desktop.
(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
a_defaultMouseSpeed = 2
a_detectHiddenText = on
a_detectHiddenWindows = off
a_isCritical = off
a_sendMode = event
a_stringCaseSense = off
a_titleMatchMode = 1
a_titleMatchModeSpeed = fast
a_winDelay = 100
clipboard =
*/
built_in(bi_name, bi_value="") {
global
if (bi_value = "restore") or (bi_value = "r")
bi_value := restore_%bi_name%
else if (bi_value = "default") or (bi_value = "d")
iniRead, bi_value, % a_lineFile, built-in defaults, % bi_name
else restore_%bi_name% := %bi_name% ; else save the current value
if (bi_name = "a_autoTrim")
autoTrim, % bi_value
else if (bi_name = "a_batchLines")
setBatchLines, % bi_value
else if (bi_name = "a_controlDelay")
setControlDelay, % bi_value
else if (bi_name = "a_coordModeCaret")
coordMode, caret, % bi_value
else if (bi_name = "a_coordModeMenu")
coordMode, menu, % bi_value
else if (bi_name = "a_coordModeMouse")
coordMode, mouse, % bi_value
else if (bi_name = "a_coordModePixel")
coordMode, pixel, % bi_value
else if (bi_name = "a_coordModeToolTip")
coordMode, toolTip, % bi_value
else if (bi_name = "a_defaultMouseSpeed")
setDefaultMouseSpeed, % bi_value
else if (bi_name = "a_detectHiddenText")
detectHiddenText, % bi_value
else if (bi_name = "a_detectHiddenWindows")
detectHiddenWindows, % bi_value
else if (bi_name = "a_isCritical")
critical, % bi_value
else if (bi_name = "a_isPaused")
pause, % bi_value
else if (bi_name = "a_stringCaseSense")
stringCaseSense, % bi_value
else if (bi_name = "a_titleMatchMode") or (bi_name = "a_titleMatchModeSpeed")
setTitleMatchMode, % bi_value
else if (bi_name = "a_winDelay")
setWinDelay, % bi_value
else if (bi_name = "clipboard")
clipboard := bi_value
}
/*
[built_in]
version = 1.2
description = change, restore or reset various built-in script settings
author = davebrny
source = https://gist.github.com/davebrny/02167ebb09cedfb922f875917c23b26b
*/
@davebrny
Copy link
Author

davebrny commented Jan 30, 2017

built_in("a_detectHiddenWindows", "on")
winClose, % hidden_window
built_in("a_detectHiddenWindows", "restore")
msgBox, % a_batchLines

built_in("a_BatchLines", "20 ms")
msgBox, % a_batchLines

built_in("a_BatchLines", "15")
msgBox, % a_batchLines

built_in("a_BatchLines", "restore")
msgBox, % a_batchLines

built_in("a_BatchLines", "default")
msgBox, % a_batchLines

built_in("a_BatchLines", "-1")
msgBox, % a_batchLines

built_in("a_BatchLines", "40ms")
msgBox, % a_batchLines

built_in("a_BatchLines", "r")  ; restore
msgBox, % a_batchLines

➜ sublime text snippets

built_in("a_autoTrim", "on|off|r|d")  
built_in("a_batchLines", "-1|20|lineCount|r|d")  
built_in("a_controlDelay", "-1|0|20|r|d")  
built_in("a_coordModeCaret", "screen|window|client|r|d")  
built_in("a_coordModeMenu", "screen|window|client|r|d")  
built_in("a_coordModeMouse", "screen|window|client|r|d")  
built_in("a_coordModePixel", "screen|window|client|r|d")  
built_in("a_coordModeToolTip", "screen|window|client|r|d")  
built_in("a_defaultMouseSpeed", "0|100|r|d")  
built_in("a_detectHiddenText", "on|off|r|d")  
built_in("a_detectHiddenWindows", "on|off|r|d")  
built_in("a_isCritical", "on|off|50|r|d")  
built_in("a_isPaused", "on|off|toggle|r|d")  
built_in("a_isSuspended", "on|off|toggle|permit|r|d")  
built_in("a_sendMode", "input|play|event|inputThenPlay|r|d")  
built_in("a_stringCaseSense", "on|off|locale|r|d")  
built_in("a_titleMatchMode", "1|2|3|regEx|r|d")  
built_in("a_titleMatchSpeed", "slow|fast|r|d")  
built_in("a_winDelay", "-1|0|100|r|d")  
built_in("clipboard", value|clipboardAll "|r|d")    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment