From 14a625a53fa41a11b4c8e24a889c419a77d9bdf6 Mon Sep 17 00:00:00 2001 From: Stephen Nilsen Date: Thu, 26 Jan 2023 15:05:56 -0600 Subject: [PATCH] Init commit --- README.md | 2 +- mac.ahk | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 mac.ahk diff --git a/README.md b/README.md index 162ad97..96b50d7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# mac-keyboard-behavior-in-windows +# MacOS Keyboard Behavior in Windows This AutoHotKey script gets you all the MacOS keyboard shortcuts in Windows! To use this script, you need to first remap you Ctrl and Alt keys using something like remapkey.exe diff --git a/mac.ahk b/mac.ahk new file mode 100644 index 0000000..0d7251a --- /dev/null +++ b/mac.ahk @@ -0,0 +1,55 @@ +; Relauch as admin if not already running as admin +full_command_line := DllCall("GetCommandLine", "str") + +if (!(A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))) +{ + try + { + if (A_IsCompiled) + Run *RunAs "%A_ScriptFullPath%" /restart + else + Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%" + } + ExitApp +} + +#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. + +; Uncomment for key history +; #InstallKeybdHook +; KeyHistory + +; This script assumes that Alt and Ctrl characters have been swapped using remapkey.exe + +; -----GUIDE----- +; # Win. (the key with the Windows logo) therefore `Send #e` would hold down Win and then press E. +; + Shift. For example, `Send, +abC` would send the text "AbC", and `Send, !+a` would press Alt+Shift+A. +; ^ Alt (because of remapkey). For example, `Send, This is text!a` would send the keys "This is text" and then press Alt+A. Note: !A produces a different effect in some programs than !a. This is because !A presses Alt+Shift+A and !a presses Alt+A. If in doubt, use lowercase. +; ! Ctrl (because of remapkey). For example, `Send, ^!a` would press Ctrl+Alt+A, and Send, ^{Home} would send Ctrl+Home. Note: ^A produces a different effect in some programs than ^a. This is because ^A presses Ctrl+Shift+A and ^a presses Ctrl+A. If in doubt, use lowercase.Sends Ctrl. For example, Send, ^!a would press Ctrl+Alt+A, and Send, ^{Home} would send Ctrl+Home. Note: ^A produces a different effect in some programs than ^a. This is because ^A presses Ctrl+Shift+A and ^a presses Ctrl+A. If in doubt, use lowercase. +; & An ampersand may be used between any two keys or mouse buttons to combine them into a custom hotkey. + +; App and tab switching +Ctrl & Tab::AltTab +!Tab::Send ^{Tab} + +; Quit the active app +^q::Send, !{f4} + +; Insertion point movement +^Left::Send, {Home} +^Right::Send, {End} +^Up::Send, ^{Home} +^Down::Send, ^{End} +#Left:: + Suspend, On + Send, ^{Left} + Suspend, Off +return +#Right:: + Suspend, On + Send, ^{Right} + Suspend, Off +return \ No newline at end of file