Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
JoeGlines / long press 3 secs to sleep.ahk
Created Oct 8, 2021
longpess escape for 3 seconds to go to sleep
View long press 3 secs to sleep.ahk
#SingleInstance,Force
;~ http://www.autohotkey.com/board/topic/80697-long-keypress-hotkeys-wo-modifiers/
~$Esc:: ; Long press (> 0.5 sec) on Esc closes window
KeyWait, Escape, T3 ; Wait no more than 0.5 sec for key release (also suppress auto-repeat)
If ErrorLevel ; timeout, so long press
PostMessage, 0x112, 0xF060,,, A ;Use PostMessage to close window
Return
View Fix Windows 10 clipboard manager.ahk
#SingleInstance,Force
#NoEnv
;********************Fix stupid Windows clipboard***********************************
#IfWinActive ahk_class Shell_LightDismissOverlay
enter:: ;when hit enter key
Send, {space} ;send the space key
return ;Stop from moving forward
View Email gui exampl.ahk
#SingleInstance, Force
;**************************************
Gui, +AlwaysOnTop
Gui, Color, cbaac86
Gui, Add, Text, x21 y7 w124, Customer
Gui, Add, Text, x28 y36 w124, Number
Gui, Add, Text, x38 y64 w124, Expiry
Gui, Add, Text, x45 y93 w124, Sec
Gui, Add, Text, x40 y122 w124, Name
@JoeGlines
JoeGlines / in list.ahk
Last active Sep 12, 2021
Put items in a format for in-list query
View in list.ahk
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
;~ #Include <default_Settings>
#SingleInstance,Force
;***********save clipboard to retore later*******************
Store:=ClipboardAll ;Store full version of Clipboard
clipboard = ; Empty the clipboard
SendInput, ^c ;changd from Send 11/23
View insert hyperlinks in excel.ahk
View Insert pretty link.ahk
View zoom launcher.ahk
#SingleInstance,Force
Appskey & z:: ;launch my zoom meeting
run %comspec% /c ""%A_AppData%\Zoom\bin\Zoom.exe" "--url=zoommtg://zoom.us/join?action=join&confno=8155790366&pwd=myPassword"",,hide
WinWait, Zoom Meeting
Sleep, 100
Send !v ;Alt V is typical hotkey for toggling video
return
View Find Column Header in Excel & return location.ahk
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
XL:=XL_Handle(1) ;Get pointer to Excel
;***********call function*******************
loc:=XL_Find_Headers_in_Cols(XL,["email","country","Age"]) ;pass search terms as an array
MsgBox % "email: " loc["email"] . "`nCountry: " loc["country"] . "`nAge: " loc["Age"]
;********************search***Find columns based on header********************************.
View Run as Admin.ahk
;~The script needs to be run at an elevated level- this takes care of that
if (! A_IsAdmin){ ;http://ahkscript.org/docs/Variables.htm#IsAdmin
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
View ParseJson.ahk
;be sure to use 32-bit AutoHotkey
ParseJSON(jsonStr){
static SC:=ComObjCreate("ScriptControl"),C:=Chr(125)
SC.Language:="JScript",ComObjError(0),SC.ExecuteStatement("function arrangeForAhkTraversing(obj){if(obj instanceof Array){for(var i=0; i<obj.length; ++i)obj[i]=arrangeForAhkTraversing(obj[i]);return ['array',obj];" C "else if(obj instanceof Object){var keys=[],values=[];for(var key in obj){keys.push(key);values.push(arrangeForAhkTraversing(obj[key]));" C "return ['object',[keys,values]];" C "else return [typeof obj,obj];" C ";obj=" jsonStr)
return convertJScriptObjToAhks(SC.Eval("arrangeForAhkTraversing(obj)"))
}ConvertJScriptObjToAhks(JSObj){
if(JSObj[0]="Object"){
Obj:=[],Keys:=JSObj[1][0],Values:=JSObj[1][1]
while(A_Index<=Keys.length)
Obj[Keys[A_Index-1]]:=ConvertJScriptObjToAhks(Values[A_Index-1])