Search code examples
windows-7autohotkeykeymapping

Mapping RightAlt+Ctrl+a to send Ctrl+Delete?


I have the following map:

>!+a::SendInput,+{Delete}

It's supposed to send Ctrl+Delete (delete word after cursor) when I press RightAlt+Ctrl+a but instead it's sending a Ctrl+Alt+Delete signal so it's bringing up the Windows 7 menu of shutdown, start task manager etc.

How can I send the right signal?

Appreciate any help!


Solution

  • The problem you are facing is that Ctrl + Alt + Delete is hard coded and is uninterruptible. There's simply no way around it, if you press that sequence, even with the Command BlockInput enabled, Windows will re-enable input and execute the command...

    Try:

    >!^a:: ; + symbol is Shift ^ represents Ctrl key
    KeyWait, RAlt ; Waits for Right Alt to be released before Ctrl Delete is sent
    SendInput,{Ctrl Down}{Delete}{Ctrl Up}
    Return
    

    An alternative although it works the exact same way:

    >!^a:: 
    While (GetKeyState("RAlt", "P"))
        Continue
    SendInput,{Ctrl Down}{Delete}{Ctrl Up}
    Return
    

    I'll continue to pursue other options.. at the moment I can I think of no better way to do this.