Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Create a shortcut to: "C:\Program Files\AutoHotkey\AutoHotkey.exe" "C:\ahk\init.d.ahk"
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #SingleInstance force
- #NoTrayIcon
- ; Run any Autohotkey scripts inside of .\init.d\
- Loop, .\init.d\*.ahk
- Run, %A_LoopFileLongPath%
- ; Run any compiled Autohotkey scripts inside of .\init.d\
- Loop, .\init.d\*.exe
- Run, %A_LoopFileLongPath%
- ;Run, .\ISense\ISense.ahk
- ;;;;;;;;;;;;;;;;;; Custom Text Shortcuts ;;;;;;;;;;;;;;;;;;
- ;::skp::http://db.tt/g3NLgMy
- ;;;;;;;;;;;;;;;;;; Custom Key Maps ;;;;;;;;;;;;;;;;;;
- ; Map Ctrl+F12 to reload the script
- ^F12::
- {
- Reload
- Return
- }
- #s::
- {
- Run, nircmd lockws
- Sleep, 2000
- Run, nircmd monitor off
- Return
- }
- ; Map Pause to middle click (for stupid FK'n SetPoint)
- Pause::
- {
- Click, Middle
- Return
- }
- ; Map Alt+9 to hyperlink text
- !9::
- {
- Sleep, 100
- clipurl := Clipboard
- Send ^c
- Sleep, 50
- clipurl2 := "<a href=""" . clipurl . """ title="""">" . clipboard . "</a>"
- SendInput {Raw}%clipurl2%
- Clipboard := clipurl
- clipurl =;
- Return
- }
- ; Map Alt+0 to img the clipboard
- !0::
- {
- Sleep, 100
- clipurl := Clipboard
- clipurl2 := "<img src=""" . clipurl . """ width="""" height="""" border=""0"" alt="""" />"
- SendInput {Raw}%clipurl2%
- clipurl =;
- Return
- }
- ; Map Win+KeypadN to resizing windows to sections on the desktop
- #Numpad1::
- {
- ; Bottom-Left Monitor: Left Side of Screen
- WinMove, A, , -1920, 0, 1287, 1040
- Return
- }
- #Numpad2::
- {
- ; Bottom-Left Monitor: Right Side of Screen
- WinMove, A, , -1287, 0, 1287, 1040
- Return
- }
- #Numpad4::
- {
- ; Bottom-Center Monitor: Left Side of Screen
- WinMove, A, , 0, 0, 1287, 1040
- Return
- }
- #Numpad5::
- {
- ; Bottom-Center Monitor: Right Side of Screen
- WinMove, A, , 633, 0, 1287, 1040
- Return
- }
- #Numpad3::
- {
- ; Bottom-Right Monitor: Left Side of Screen
- WinMove, A, , 1920, 0, 1287, 1040
- Return
- }
- #Numpad6::
- {
- ; Bottom-Right Monitor: Right Side of Screen
- WinMove, A, , 2553, 0, 1287, 1040
- Return
- }
- #Numpad7::
- {
- ; Top-Center Monitor: Left Side of Screen
- WinMove, A, , 0, -1080, 1287, 1040
- Return
- }
- #Numpad8::
- {
- ; Top-Center Monitor: Right Side of Screen
- WinMove, A, , 633, -1080, 1287, 1040
- Return
- }
- ; Map Ctrl+Win+P to copy current IP to clipboard
- ^#p::
- {
- UrlDownloadToFile, https://api.ipify.org/, ip.txt
- FileRead, currentIP, ip.txt
- FileDelete, ip.txt
- Clipboard = %currentIP%
- Return
- }
- ; Map Win+P to output current IP
- #p::
- {
- UrlDownloadToFile, https://api.ipify.org/, ip.txt
- FileRead, currentIP, ip.txt
- FileDelete, ip.txt
- Send, %currentIP%
- Return
- }
- ; Map Double RShift to Launchy
- ;~RShift::DoubleKey("{Alt Down}{Space}{Alt Up}", 350)
- ;~LShift::DoubleKey("{Alt Down}{Space}{Alt Up}", 350)
- ; Map Double LShift to KeePass
- ;~LShift Up::DoubleKey("^!k", 350)
- ; Map Double LCtrl to KeePass Auto-fill
- ;~LCtrl Up::DoubleKey("^!a", 350)
- ; Map Ctrl+Shift+F5 to build Dropbox.u3p
- ;^+F5::
- ;{
- ; Run, C:\ahk\u3\Dropbox\Build.lnk
- ; Return
- ;}
- ; Detect clipboard change and trim contents
- ;OnClipboardChange:
- ;{
- ; Clipboard = %Clipboard%
- ; ToolTip, Clipboard contents have been trimmed
- ; Sleep, 1500
- ; ToolTip
- ; Return
- ;}
- ; Map Win+Capslock as a dedicated minimize button
- IfEqual, A_ComputerName, DALE3H-MOBILE
- {
- #IfWinNotActive, ahk_class SynergyDesk
- {
- #Capslock::WinMinimize,A
- Return
- }
- Return
- }
- ; Map Insert key to nothing
- ;Insert::
- ;{
- ; Return
- ;}
- ; Map Ctrl+Insert key to append-to-clipboard
- ;+Insert::
- ;{
- ; bak = %Clipboard%
- ; Send, ^c
- ; Clipboard = %bak%`r`n%Clipboard%
- ; Return
- ;}
- ; Map Alt+Insert as a template paste feature
- ;!Insert::
- ;{
- ; bak = %Clipboard%
- ; Send, ^c
- ; StringReplace, Clipboard, bak, @@, %Clipboard%
- ; Send, ^v
- ; Clipboard = %bak%
- ; Return
- ;}
- ; Map Alt+` to hide/show launch TeamViewer
- !`::
- {
- DetectHiddenWindows, On
- IfWinExist, TeamViewer ahk_class #32770
- {
- IfWinActive
- {
- WinHide
- WinActivate, Program Manager
- }
- Else
- {
- WinShow
- WinActivate
- }
- }
- Else
- {
- Run, "C:\Program Files (x86)\TeamViewer\TeamViewer.exe"
- }
- DetectHiddenWindows, Off
- Return
- }
- ; Map Ctrl+Shift+K to open www version file of current file
- #IfWinActive, EditPlus -
- {
- ^+k::
- {
- Send, ^+g
- Send, ^c
- Send, {Esc}
- Send, ^+o
- Send, ^v
- Send, {Home}{Right}
- Send, {Shift Down}{Right}{Right}{Right}{Right}{Shift Up}
- Send, www{Enter}
- }
- Return
- }
- #IfWinActive, ahk_class Console_2_Main
- {
- Esc::
- {
- WinHide, ahk_class Console_2_Main
- WinActivate, ahk_class Shell_TrayWnd
- }
- ^d::
- {
- WinHide, ahk_class Console_2_Main
- WinActivate, ahk_class Shell_TrayWnd
- }
- Return
- }
- ; Map Ctrl+D in command prompt to exit
- #IfWinActive, ahk_class ConsoleWindowClass
- {
- ^d::
- {
- WinKill, A
- }
- Return
- }
- ; Map Ctrl+L to F6 (location bar) in IE
- #IfWinActive, ahk_class IEFrame
- {
- ^l::
- {
- Send, {F6}
- }
- Return
- }
- ; Map Ctrl+W to Exit in HomeSeer
- #IfWinActive, ahk_class WindowsForms10.Window.8.app.0.378734a
- {
- ^w::
- {
- Send, !f
- Send, {Up}{Enter}
- }
- Return
- }
- ; Double tap extender
- ;DoubleKey(sendKeys, timeout)
- ;{
- ; If (A_PriorHotKey = A_ThisHotKey AND A_TimeSincePriorHotkey < timeout)
- ; Send, %sendKeys%
- ;}
- ; Custom functions for code listed above
- UrlDownloadToVar(URL, Proxy="", ProxyBypass="") {
- AutoTrim, Off
- hModule := DllCall("LoadLibrary", "str", "wininet.dll")
- If (Proxy != "")
- AccessType=3
- Else
- AccessType=1
- ;INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
- ;INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
- ;INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
- ;INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
- io_hInternet := DllCall("wininet\InternetOpenA"
- , "str", "" ;lpszAgent
- , "uint", AccessType
- , "str", Proxy
- , "str", ProxyBypass
- , "uint", 0) ;dwFlags
- iou := DllCall("wininet\InternetOpenUrlA"
- , "uint", io_hInternet
- , "str", url
- , "str", "" ;lpszHeaders
- , "uint", 0 ;dwHeadersLength
- , "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
- , "uint", 0) ;dwContext
- If (ErrorLevel != 0 or iou = 0) {
- DllCall("FreeLibrary", "uint", hModule)
- return 0
- }
- VarSetCapacity(buffer, 512, 0)
- VarSetCapacity(NumberOfBytesRead, 4, 0)
- Loop
- {
- irf := DllCall("wininet\InternetReadFile", "uint", iou, "uint", &buffer, "uint", 512, "uint", &NumberOfBytesRead)
- NOBR = 0
- Loop 4 ; Build the integer by adding up its bytes. - ExtractInteger
- NOBR += *(&NumberOfBytesRead + A_Index-1) << 8*(A_Index-1)
- IfEqual, NOBR, 0, break
- ;BytesReadTotal += NOBR
- DllCall("lstrcpy", "str", buffer, "uint", &buffer)
- res = %res%%buffer%
- }
- StringTrimRight, res, res, 2
- DllCall("wininet\InternetCloseHandle", "uint", iou)
- DllCall("wininet\InternetCloseHandle", "uint", io_hInternet)
- DllCall("FreeLibrary", "uint", hModule)
- AutoTrim, on
- return, res
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement