Mapping OS X text editing shortcuts to Windows Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
keith

Mapping OS X text editing shortcuts to Windows

23 Feb 2017, 06:47

I want to map the following keys.
  • swap win and ctrl
    alt-left/alt-right to ctrl-left/ctrl-right
    ctrl-left to home
    ctrl-right to end
    shift-ctrl-left to shift-home
    shift-ctrl-right to shift-end
I also want to repeatedly press the left and right keys in the home and end cases without releasing the modifier keys. The following script does not work because the original modifier keys are still effective in the mapped keys. For example, pressing ^Left is actually ^Home.

Code: Select all

LWin::LCtrl
LCtrl::LWin
RWin::RCtrl
RCtrl::RWin
!Left::^Left
!Right::^Right
^Left::Home
^Right::End
The following script stops the original modifier being effective but pressing Left twice while holding Ctrl gives me Home then Left.

Code: Select all

LWin::LCtrl
LCtrl::LWin
RWin::RCtrl
RCtrl::RWin
!Left::^Left
!Right::^Right
^Left::Send {Home}
^Right::Send {End}
What should the script be?
bigdeal
Posts: 66
Joined: 13 Feb 2017, 06:31

Re: Mapping OS X text editing shortcuts to Windows  Topic is solved

23 Feb 2017, 09:10

Code: Select all

~LWin::LCtrl
~LCtrl::LWin
~RWin::RCtrl
~RCtrl::RWin
!Left::^Left
!Right::^Right
^Left::Home
^Right::End
tell me if it helps
keith

Re: Mapping OS X text editing shortcuts to Windows

24 Feb 2017, 04:22

I tested the following code. If I held LWin then pressed Left, Right and Left, I got Home, Right but nothing more. It seemed that GetKeyState returned false after the first LWin+Left. I changed the code to check the physical state of LWin so I have had some desired result. I wonder if it is an expected result or a bug of GetKeyState returning false in my case.

Code: Select all

LWin::LCtrl
LCtrl::LWin
RWin::RCtrl
RCtrl::RWin

*Left::
if GetKeyState("Ctrl")
{
	SendInput {Home}
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk and 345 guests