Created
October 29, 2018 19:31
-
-
Save jingzhehu/3893a3b9f45728bf83cf381ca93f34f3 to your computer and use it in GitHub Desktop.
Simulate Mac keyboard shortcut for Windows
This file contains hidden or 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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
#Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory | |
; Make Ctrl + S work with cmd (windows) key | |
#s:: | |
Send,^s | |
Return | |
; Selecting | |
#a:: | |
Send, ^a | |
Return | |
; Copying | |
#c:: | |
Send, ^c | |
Return | |
; Pasting | |
#v:: | |
Send, ^v | |
Return | |
; Cutting | |
#x:: | |
Send, ^x | |
Return | |
; Opening | |
#o:: | |
Send, ^o | |
Return | |
; Finding | |
#f:: | |
Send, ^f | |
Return | |
#+f:: | |
Send, ^+f | |
Return | |
; Undo | |
#z:: | |
Send, ^z | |
Return | |
; Redo | |
#y:: | |
Send, ^y | |
Return | |
; New tab | |
#t:: | |
Send, ^t | |
Return | |
; New window | |
#n:: | |
Send, ^n | |
Return | |
; Close tab | |
#w:: | |
Send, ^w | |
Return | |
#q:: | |
Send, !{F4} | |
Return | |
; Search bar | |
#l:: | |
Send, ^l | |
Return | |
; Search bar | |
#j:: | |
Send, ^j | |
Return | |
; Search bar | |
#g:: | |
Send, ^g | |
Return | |
#+g:: | |
Send, ^+g | |
Return | |
; refresh | |
#r:: | |
Send, ^r | |
Return | |
#k:: | |
Send, ^l | |
Return | |
; change language | |
!space:: | |
Send, #{space} | |
Return | |
#Space:: | |
Send, ^!{Space} | |
Return | |
f12:: | |
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableLockWorkstation, 0 | |
DllCall("LockWorkStation") | |
sleep, 200 | |
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableLockWorkstation, 1 | |
return | |
Capslock::Ctrl | |
;^!#+ | |
+Down:: | |
offset_x := 20 | |
offset_y := 8 | |
SysGet, BoundingCoordinates, MonitorWorkArea | |
ResolutionWidth := BoundingCoordinatesRight - BoundingCoordinatesLeft | |
ResolutionHeight := BoundingCoordinatesBottom - BoundingCoordinatesTop | |
AdjustedWidth := 0.60 * ResolutionWidth + offset_x | |
AdjustedHeight:= 0.60 * ResolutionHeight + offset_y | |
LeftMargin := 0.2 * ResolutionWidth | |
TopMargin := 0.2 * ResolutionHeight | |
WinMove A, , LeftMargin, TopMargin, AdjustedWidth, AdjustedHeight | |
return | |
+Up:: | |
offset_x := 20 | |
offset_y := 8 | |
SysGet, BoundingCoordinates, MonitorWorkArea | |
ResolutionWidth := BoundingCoordinatesRight - BoundingCoordinatesLeft | |
ResolutionHeight := BoundingCoordinatesBottom - BoundingCoordinatesTop | |
AdjustedWidth := 1 * ResolutionWidth + offset_x | |
AdjustedHeight:= 1 * ResolutionHeight + offset_y | |
LeftMargin := -8 | |
TopMargin := 0 | |
WinMove A, , LeftMargin, TopMargin, AdjustedWidth, AdjustedHeight | |
return | |
+Left:: | |
offset_x := 20 | |
offset_y := 8 | |
SysGet, BoundingCoordinates, MonitorWorkArea | |
ResolutionWidth := BoundingCoordinatesRight - BoundingCoordinatesLeft | |
ResolutionHeight := BoundingCoordinatesBottom - BoundingCoordinatesTop | |
AdjustedWidth := 0.5 * ResolutionWidth + offset_x | |
AdjustedHeight:= 1.0 * ResolutionHeight + offset_y | |
LeftMargin := 0 * ResolutionWidth - 8 | |
TopMargin := 0 * ResolutionHeight | |
WinMove A, , LeftMargin, TopMargin, AdjustedWidth, AdjustedHeight | |
return | |
+Right:: | |
offset_x := 20 | |
offset_y := 8 | |
SysGet, BoundingCoordinates, MonitorWorkArea | |
ResolutionWidth := BoundingCoordinatesRight - BoundingCoordinatesLeft | |
ResolutionHeight := BoundingCoordinatesBottom - BoundingCoordinatesTop | |
AdjustedWidth := 0.5 * ResolutionWidth + offset_x | |
AdjustedHeight:= 1.0 * ResolutionHeight + offset_y | |
LeftMargin := 0.5 * ResolutionWidth - 8 | |
TopMargin := 0 * ResolutionHeight | |
WinMove A, , LeftMargin, TopMargin, AdjustedWidth, AdjustedHeight | |
Send, {BoundingCoordinatesLeft} | |
return | |
#!^Left:: | |
offset_x := 20 | |
offset_y := 8 | |
SysGet, BoundingCoordinates, MonitorWorkArea | |
ResolutionWidth := BoundingCoordinatesRight - BoundingCoordinatesLeft | |
ResolutionHeight := BoundingCoordinatesBottom - BoundingCoordinatesTop | |
AdjustedWidth := 0.5 * ResolutionWidth + offset_x | |
AdjustedHeight:= 0.5 * ResolutionHeight + offset_y | |
LeftMargin := 0 * ResolutionWidth - 8 | |
TopMargin := 0 * ResolutionHeight | |
WinMove A, , LeftMargin, TopMargin, AdjustedWidth, AdjustedHeight | |
return | |
#!^Down:: | |
offset_x := 20 | |
offset_y := 8 | |
SysGet, BoundingCoordinates, MonitorWorkArea | |
ResolutionWidth := BoundingCoordinatesRight - BoundingCoordinatesLeft | |
ResolutionHeight := BoundingCoordinatesBottom - BoundingCoordinatesTop | |
AdjustedWidth := 0.5 * ResolutionWidth + offset_x | |
AdjustedHeight:= 0.5 * ResolutionHeight + offset_y + 4 | |
LeftMargin := 0 * ResolutionWidth - 8 | |
TopMargin := 0.5 * ResolutionHeight - 2 | |
WinMove A, , LeftMargin, TopMargin, AdjustedWidth, AdjustedHeight | |
return | |
#!^Up:: | |
offset_x := 20 | |
offset_y := 8 | |
SysGet, BoundingCoordinates, MonitorWorkArea | |
ResolutionWidth := BoundingCoordinatesRight - BoundingCoordinatesLeft | |
ResolutionHeight := BoundingCoordinatesBottom - BoundingCoordinatesTop | |
AdjustedWidth := 0.5 * ResolutionWidth + offset_x | |
AdjustedHeight:= 0.5 * ResolutionHeight + offset_y | |
LeftMargin := 0.5 * ResolutionWidth - 8 | |
TopMargin := 0 * ResolutionHeight | |
WinMove A, , LeftMargin, TopMargin, AdjustedWidth, AdjustedHeight | |
return | |
#!^Right:: | |
offset_x := 20 | |
offset_y := 8 | |
SysGet, BoundingCoordinates, MonitorWorkArea | |
ResolutionWidth := BoundingCoordinatesRight - BoundingCoordinatesLeft | |
ResolutionHeight := BoundingCoordinatesBottom - BoundingCoordinatesTop | |
AdjustedWidth := 0.5 * ResolutionWidth + offset_x | |
AdjustedHeight:= 0.5 * ResolutionHeight + offset_y + 4 | |
LeftMargin := 0.5 * ResolutionWidth - 8 | |
TopMargin := 0.5 * ResolutionHeight - 2 | |
WinMove A, , LeftMargin, TopMargin, AdjustedWidth, AdjustedHeight | |
return | |
#LButton:: | |
Send, ^{Click} | |
Return | |
+#p:: | |
Send, +^p | |
Return | |
#Right:: | |
Send, {End} | |
Return | |
#Left:: | |
Send, {Home} | |
Return | |
#Up:: | |
Send {Lctrl down}{Home}{Lctrl up} | |
Return | |
#Down:: | |
Send {Lctrl down}{End}{Lctrl up} | |
Return | |
!Left:: | |
Send, ^{Left} | |
Return | |
!Right:: | |
Send, ^{Right} | |
Return | |
; Selection (uses a combination of the above with shift) | |
<!+Left::Send {ctrl down}{shift down}{Left}{shift up}{ctrl up} | |
<!+Right::Send {ctrl down}{shift down}{Right}{shift up}{ctrl up} | |
!+Up::Send {ctrl down}{shift down}{Up}}{shift up}{ctrl up} | |
!+Down::Send {ctrl down}{shift down}{Down}}{shift up}{ctrl up} | |
#+Left::Send {shift down}{Home}}{shift up} | |
#+Right::Send {shift down}{End}}{shift up} | |
#+Up::Send {Lctrl down}{shift down}{Home}}{shift up}{Lctrl up} | |
#+Down::Send {Lctrl down}{shift down}{End}}{shift up}{Lctrl up} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment