|
#NoTrayIcon |
|
#SingleInstance Force |
|
SendMode Input |
|
|
|
; Win+A : Open Chrome |
|
#A:: |
|
Run, "chrome.exe" |
|
Return |
|
|
|
; Win+B : Send an email |
|
#B:: |
|
Run, "mailto://" |
|
Return |
|
|
|
; Win+C : Start command line (in local directory if possible) |
|
#C:: |
|
if WinActive("ahk_class CabinetWClass") |
|
{ |
|
WinGetText, title_text, A |
|
address_pos_beg := RegExMatch(title_text, "(?<=Address: ).") |
|
address_pos_end := RegExMatch(title_text, "\r\n") |
|
address_pos_len := address_pos_end - address_pos_beg |
|
addr := SubStr(title_text, address_pos_beg, address_pos_len) |
|
|
|
; fix Windows libraries not acting like directories |
|
addr := RegExReplace(addr, "^Libraries\\", "C:\Users\" . A_UserName . "\") |
|
} |
|
else |
|
{ |
|
addr = C:\Users\%A_UserName% |
|
} |
|
Run, "C:\Windows\System32\cmd.exe" "/K cd /d %addr%" |
|
Return |
|
|
|
; Win+G: Adjust window width to golden ratio |
|
#G:: |
|
WinGetPos, ,, Width, Height, A |
|
NewWidth := Round(Height*1.61803398875) |
|
WinMove, A, ,,, NewWidth, Height |
|
Return |
|
|
|
; Win+H: Adjust window height to golden ratio |
|
#H:: |
|
WinGetPos, ,, Width, Height, A |
|
NewHeight := Round(Width/1.61803398875) |
|
WinMove, A, ,,, Width, NewHeight |
|
Return |
|
|
|
; Win+M: Toggle screen zoom (Windows Magnify tool) |
|
#M:: |
|
IfWinNotExist ahk_exe Magnify.exe |
|
Run, "C:\Windows\system32\Magnify.exe" |
|
else |
|
WinClose, Magnifier |
|
Return |
|
|
|
; Win+N : Bring Notepad++ up, or minimize if focused |
|
#N:: |
|
IfWinActive ahk_class Notepad++ |
|
WinMinimize |
|
else |
|
Run, "C:\Program Files (x86)\Notepad++\notepad++.exe" |
|
Return |
|
|
|
; Win+S : Start the Windows Snipping Tool |
|
#S:: |
|
Run, "C:\Windows\system32\SnippingTool.exe" |
|
Return |
|
|
|
; Win+F9: Toggle desktop icons |
|
#F9:: |
|
ControlGet, hwnd, Hwnd,, SysListView321, ahk_class Progman |
|
If DllCall("IsWindowVisible", UInt,hwnd) |
|
WinHide, ahk_id %hwnd% |
|
Else |
|
WinShow, ahk_id %hwnd% |
|
return |
|
|
|
; Win+Alt+Left/Right : Mirror window to other side of monitor |
|
#!Left:: |
|
#!Right:: |
|
; Get information about the active window |
|
WinGetTitle, hwnd, A |
|
WinGetPos, hwndX, hwndY, hwndWidth, hwndHeight, %hwnd% |
|
|
|
; Window Midpoint |
|
windowMidpoint := hwndX + (hwndWidth/2) |
|
|
|
; Retrieve information about the monitor the window's midpoint is on |
|
SysGet, monCount, MonitorCount |
|
Loop %monCount% |
|
{ SysGet, curMon, Monitor, %a_index% |
|
if ( windowMidpoint >= curMonLeft and windowMidpoint <= curMonRight and hwndY >= curMonTop and hwndY <= curMonBottom ) |
|
{ |
|
monitorX := curMonLeft |
|
monitorWidth := curMonRight - curMonLeft |
|
break |
|
} |
|
} |
|
|
|
; Absolute X-Midpoint of Current Monitor |
|
absoluteHalfScreenWidth := monitorX + (monitorWidth/2) |
|
|
|
; Difference between the middle of the screen and window's midpoint |
|
difference := windowMidpoint - absoluteHalfScreenWidth |
|
|
|
; Mirror the window midpoint over the halfway point |
|
newX := windowMidpoint - (2 * difference) - (hwndWidth)/2 |
|
|
|
WinMove, %hwnd%, , newX, hwndY |
|
Return |
|
|
|
; Ctrl+V : Allow pasting into Console windows |
|
#IfWinActive ahk_class ConsoleWindowClass |
|
^V:: |
|
SendInput {Raw}%clipboard% |
|
return |
|
#IfWinActive |
|
|
|
; Ctrl+Shift+V : Paste as plain text |
|
^+v:: ; Text–only paste from ClipBoard |
|
Clip0 = %ClipBoardAll% |
|
ClipBoard = %ClipBoard% ; Convert to text |
|
Send ^v ; For best compatibility: SendPlay |
|
Sleep 50 ; Don't change clipboard while it is pasted! (Sleep > 0) |
|
ClipBoard = %Clip0% ; Restore original ClipBoard |
|
VarSetCapacity(Clip0, 0) ; Free memory |
|
Return |
|
|
|
; Ctrl+' : Input a checkmark |
|
^':: |
|
Send ✓ |
|
Return |
|
|
|
; Ctrl+? : Help dialog |
|
^/:: |
|
^+/:: |
|
MsgBox, |
|
( |
|
Win+A : Open Chrome |
|
Win+B : Send an email |
|
Win+C : Start command line (in local directory if possible) |
|
Win+G : Adjust window width to golden ratio |
|
Win+H : Adjust window height to golden ratio |
|
Win+M : Toggle Windows Magnifier tool |
|
Win+N : Bring Notepad++ up, or minimize if focused |
|
Win+S : Start the Windows Snipping Tool |
|
Win+F9: Toggle desktop icons |
|
Win+Alt+Left/Right : Mirror window to other side of monitor |
|
Ctrl+V : Allow pasting into Console windows |
|
Ctrl+' : Input a checkmark |
|
Ctrl+? : Help dialog |
|
Ctrl+F12 : Restart HamiltonXRP Service |
|
Ctrl+Alt+F12 : Restart HamiltonXRP Service (with TRP enabled) |
|
Ctrl+Shift+V : Paste as plain text |
|
Alt+P : Enter passwords for IV/VSphere |
|
Alt+F12 : Input current Instinct V version |
|
) |
|
Return |
|
|
|
; Ctrl+F12 : Restart HamiltonXRP Service (without TRP enabled) |
|
^F12:: |
|
runwait, %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe "Start-Process powershell -ArgumentList '-ExecutionPolicy Bypass -File C:\bin\Restart-HamiltonXRP_Service.ps1 false'" |
|
Return |
|
|
|
; Ctrl+Alt+F12 : Restart HamiltonXRP Service (with TRP enabled) |
|
!^F12:: |
|
runwait, %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe "Start-Process powershell -ArgumentList '-ExecutionPolicy Bypass -File C:\bin\Restart-HamiltonXRP_Service.ps1 true'" |
|
Return |
|
|
|
; Alt+F12 : Input current Instinct V version (from RunMaster) |
|
!F12:: |
|
RefreshEnvironment() |
|
EnvGet, WorkbenchVersion, XRP2Version |
|
if (!WorkbenchVersion) ; if env var is blank or does not exist, grab it off the exe |
|
{ |
|
; Get raw version string |
|
EnvGet, XRP2, XRP2BaseDir |
|
FileGetVersion, WorkbenchVersion, %XRP2%\Bin\Hamilton.XRP2.Base.WorkbenchUI.exe |
|
|
|
; Split version string into parts |
|
Array := StrSplit(WorkbenchVersion, ".") |
|
|
|
; Fix version string formatting (properly padded to 5 digits) |
|
WorkbenchVersion := BuildVersionString(Array) |
|
} |
|
Send %WorkbenchVersion% |
|
Return |
|
|
|
; ----- |
|
BuildVersionString(array) |
|
{ |
|
CatStr := array[1] "." array[2] "." Pad( array[3] ) "." Pad( array[4] ) |
|
Return CatStr |
|
} |
|
|
|
Pad(PadStr) |
|
{ |
|
SetFormat, float, 05.0 |
|
PadStr += 0.0 |
|
Return PadStr |
|
} |
|
|
|
RefreshEnvironment() |
|
{ |
|
Path := "" |
|
PathExt := "" |
|
RegKeys := "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment,HKCU\Environment" |
|
Loop, Parse, RegKeys, CSV |
|
{ |
|
Loop, Reg, %A_LoopField%, V |
|
{ |
|
RegRead, Value |
|
If (A_LoopRegType == "REG_EXPAND_SZ" && !ExpandEnvironmentStrings(Value)) |
|
Continue |
|
If (A_LoopRegName = "PATH") |
|
Path .= Value . ";" |
|
Else If (A_LoopRegName = "PATHEXT") |
|
PathExt .= Value . ";" |
|
Else |
|
EnvSet, %A_LoopRegName%, %Value% |
|
} |
|
} |
|
EnvSet, PATH, %Path% |
|
EnvSet, PATHEXT, %PathExt% |
|
} |
|
|
|
ExpandEnvironmentStrings(ByRef vInputString) |
|
{ |
|
; get the required size for the expanded string |
|
vSizeNeeded := DllCall("ExpandEnvironmentStrings", "Str", vInputString, "Int", 0, "Int", 0) |
|
If (vSizeNeeded == "" || vSizeNeeded <= 0) |
|
return False ; unable to get the size for the expanded string for some reason |
|
|
|
vByteSize := vSizeNeeded + 1 |
|
If (A_PtrSize == 8) { ; Only 64-Bit builds of AHK_L will return 8, all others will be 4 or blank |
|
vByteSize *= 2 ; need to expand to wide character sizes |
|
} |
|
VarSetCapacity(vTempValue, vByteSize, 0) |
|
|
|
; attempt to expand the environment string |
|
If (!DllCall("ExpandEnvironmentStrings", "Str", vInputString, "Str", vTempValue, "Int", vSizeNeeded)) |
|
return False ; unable to expand the environment string |
|
vInputString := vTempValue |
|
|
|
; return success |
|
Return True |
|
} |
me gusta