Last active
June 26, 2019 03:43
-
-
Save dcai/ac5765f036c1b45fe13c4144047f278b to your computer and use it in GitHub Desktop.
autohotkey for westpac laptop wbc.ahk
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
; # => Win | |
; ! => Alt | |
; ^ => Ctrl | |
; + => Shift | |
SetCapsLockState, AlwaysOff | |
;; Capslock::Esc | |
CapsLock::Ctrl | |
+Capslock::Capslock | |
SetTitleMatchMode, 2 | |
; conemu | |
+^c:: | |
if WinExist("ahk_class VirtualConsoleClass") | |
WinActivate | |
return | |
; +^0:: | |
; ; emacs | |
; if WinExist("ahk_class Emacs") | |
; WinActivate | |
; return | |
+^1:: | |
; chrome | |
if WinExist("ahk_exe chrome.exe") | |
WinActivate | |
return | |
; sublime | |
+^2:: | |
if WinExist("ahk_exe sublime_text.exe") | |
WinActivate | |
else | |
Run "C:\Program Files\Sublime Text 3\sublime_text.exe" | |
return | |
; putty | |
;+^`:: | |
+^\:: | |
+^3:: | |
if WinExist("ahk_exe PUTTY.EXE") | |
WinActivate | |
else | |
Run "C:\home\putty\putty.exe" | |
return | |
; postman | |
+^4:: | |
if WinExist("ahk_exe Postman.exe") | |
WinActivate | |
return | |
; slack | |
+^s:: | |
if WinExist("ahk_exe mintty.exe") | |
WinActivate | |
return | |
+^o:: | |
if WinExist("ahk_exe OUTLOOK.EXE") | |
WinActivate | |
return | |
^!\:: | |
;; ctrl+alt+\ | |
WinMaximize, A ; Assign a hotkey to maximize the active window. | |
return | |
^!r:: | |
Reload ; Assign Ctrl-Alt-R as a hotkey to restart the script. | |
return | |
; ^j:: | |
; MsgBox Wow! | |
; MsgBox this is | |
; Run, Notepad.exe | |
; winactivate, Untitled - Notepad | |
; WinWaitActive, Untitled - Notepad | |
; send, 7 lines{!}{enter} | |
; sendinput, inside the ctrl{+}j hotkey | |
; Return | |
;;#n:: | |
;;Run Notepad | |
;;return | |
; macOS key bindings | |
#f::Send ^f | |
#q::!F4 ;退出 | |
#w::Send ^w ;关闭网页窗口 | |
!r::Send #r | |
#n::Send ^n ; new window | |
#t::Send ^t ; new tab | |
#z::Send ^z | |
#c::Send ^c ; copy | |
#v::Send ^v ; paste | |
#s::Send ^s ; save | |
!e::Send #e ; win+e | |
^#v::SendRaw %clipboard% | |
; https://superuser.com/questions/285356/possible-to-snap-top-bottom-instead-of-just-left-right-in-windows-7 | |
; credit: http://www.pixelchef.net/how-snap-windows-horizontally-windows-7 | |
; Move window up (Windows + Shift + UP ... NOTE must maximize window first) | |
+#Up:: | |
WinGetPos,X,Y,W,H,A,,, | |
WinMaximize | |
WinGetPos,TX,TY,TW,TH,ahk_class Shell_TrayWnd,,, | |
; if this is greater than 1, we're on the secondary (right) monitor. This | |
; means the center of the active window is a positive X coordinate | |
if ( X + W/2 > 0 ) { | |
SysGet, MonitorWorkArea, MonitorWorkArea, 1 | |
WinMove,A,,X,0 , , (MonitorWorkAreaBottom/2) | |
} | |
else { | |
SysGet, MonitorWorkArea, MonitorWorkArea, 2 | |
WinMove,A,,X,0 , , (MonitorWorkAreaBottom/2) | |
} | |
return | |
; Move window down (Windows + Shift + DOWN ... NOTE must maximize window first) | |
+#Down:: | |
WinGetPos,X,Y,W,H,A,,, | |
WinMaximize | |
WinGetPos,TX,TY,TW,TH,ahk_class Shell_TrayWnd,,, | |
; if this is greater than 1, we're on the secondary (right) monitor. This | |
; means the center of the active window is a positive X coordinate | |
if ( X + W/2 > 0 ) { | |
SysGet, MonitorWorkArea, MonitorWorkArea, 1 | |
WinMove,A,,X,MonitorWorkAreaBottom/2 , , (MonitorWorkAreaBottom/2) | |
} | |
else { | |
SysGet, MonitorWorkArea, MonitorWorkArea, 2 | |
WinMove,A,,X,MonitorWorkAreaBottom/2 , , (MonitorWorkAreaBottom/2) | |
} | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment