Remapping of right-alt and CoPilot key constantly being undone

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
eileen60016
Posts: 5
Joined: 03 Oct 2024, 15:25

Remapping of right-alt and CoPilot key constantly being undone

Post by eileen60016 » 03 Oct 2024, 15:36

Hi,
I am a total newbie to AutoHotkey. I don't understand how to do registry edits, etc.
I used someone else's script to remap my keys. The scripts are:

For CoPilot key

Code: Select all

#SingleInstance 
<+<#f23::Send "{Blind}{LShift Up}{LWin Up}{RControl Down}" 
<+<#f23 Up::Send "{RControl Up}"


For right-alt key

Code: Select all

RAlt::delete
return
My concern: multiple times a day, at seemingly random intervals, Windows (or something else? I have no idea) seems to revert these keys to their original purpose. For example, pressing the right-alt key while in word will cause all these random flags to pop up all over the menus (see 1st image) while the CoPilot key brings up some CoPilot related webpage (see 2nd image).

What is everyone else doing to prevent things like this? It is super annoying because I randomly have to go back to the scripts and double click on them to re-run. Sometimes when I re-run the right alt script, I get this message (see 3rd attachment). It never shows me that message for the CoPilot script.

Thank you so much for your assistance. I did a forum search for "overwritten" but didn't see anything that seemed related.
Attachments
Screenshot 2024-10-03 133235.png
Screenshot 2024-10-03 133235.png (14.52 KiB) Viewed 1209 times
Screenshot 2024-10-03 133035.png
Screenshot 2024-10-03 133035.png (143.75 KiB) Viewed 1209 times
Screenshot 2024-10-03 132851.png
Screenshot 2024-10-03 132851.png (73.38 KiB) Viewed 1209 times
Last edited by Ragnar on 03 Oct 2024, 15:42, edited 1 time in total.
Reason: code tags

eileen60016
Posts: 5
Joined: 03 Oct 2024, 15:25

Re: Remapping of right-alt and CoPilot key constantly being undone

Post by eileen60016 » 11 Oct 2024, 10:59

Bummed out that no one had any answers but I might have identified my own solution!

I noticed the #SingleInstance line in one of the scripts and put it into the other. Since I did that several days ago, both scripts seem to have remained stable.

Thanks to all who read the original inquiry.

eileen60016
Posts: 5
Joined: 03 Oct 2024, 15:25

Re: Remapping of right-alt and CoPilot key constantly being undone

Post by eileen60016 » 22 Oct 2024, 17:45

Well, that was a bust. For a while there I didn't need to reopen the scripts for days at a time.
No idea what happened to change my operating environment but today I've had to rerun the scripts at least 6-7 times over the course of the day.

blooest
Posts: 2
Joined: 25 Oct 2024, 17:30
Contact:

Re: Remapping of right-alt and CoPilot key constantly being undone

Post by blooest » 25 Oct 2024, 17:44

Since nobody else has answered you here, I have a few thoughts. Can't guarantee anything as I've not encountered this problem (nor do I have a copilot key), but it might help.
I've had scripts be really unreliable when trying to run multiple at once. I would propose that you combine the two. As easy as just pasting what you have posted for the RAlt key into the same file as the copilot key stuff.
I think it's implied by the hotkey, but I also like forcing the usage of the keyboard hook.
You can also add a hotkey to reload the script, which would at least make the workaround easier (unless it also stops working, anyway, but if that's the case you've got something that can't be solved from the AHK side going on)
All together now:

Code: Select all

; directives
#Requires AutoHotkey v2.0
#UseHook true
#SingleInstance 

; copilot
<+<#f23::Send "{Blind}{LShift Up}{LWin Up}{RControl Down}" 
<+<#f23 Up::Send "{RControl Up}"

; ralt
RAlt::delete
; note that Return is not needed here as this is a simple single-line replacement

; reload on ctrl alt r
^!r::Reload()
Your code may be in V1 format judging by that Return, but you're in the V2 section here. If you're on V1, I think all you need to do is remove the parentheses from Reload and the version directive.

eileen60016
Posts: 5
Joined: 03 Oct 2024, 15:25

Re: Remapping of right-alt and CoPilot key constantly being undone

Post by eileen60016 » 26 Oct 2024, 19:07

Thank you so much! I was just copying and pasting code that I had seen elsewhere so I appreciate your combining the material and adding some tidbits on my behalf!

This is the version I'm using. At the top it say v1.xxxx but then in the "Base File" area it says v2.xxxxx so I have no idea what I am actually using.
Attachments
Screenshot 2024-10-26 170233.png
Screenshot 2024-10-26 170233.png (42.88 KiB) Viewed 756 times
image.png
image.png (42.88 KiB) Viewed 756 times

Zeroes
Posts: 24
Joined: 07 Mar 2023, 04:03

Re: Remapping of right-alt and CoPilot key constantly being undone

Post by Zeroes » 28 Oct 2024, 14:20

You use latest version 2.x AHK - 2.0.18
1.1.37 It's current latest version converter AHK script to EXE file (standalone)
it's usefull convert single sripts to EXE for run manually

eileen60016
Posts: 5
Joined: 03 Oct 2024, 15:25

Re: Remapping of right-alt and CoPilot key constantly being undone

Post by eileen60016 » 12 Dec 2024, 12:19

Just seeing this now (months later). Thank you for clarifying!

Another update: everything seems stable again, not having to rerun the script multiple times a day anymore, just when I restart my computer.
Not sure what is driving the erratic behavior when it occurs. Happy holidays all.
Zeroes wrote: You use latest version 2.x AHK - 2.0.18
1.1.37 It's current latest version converter AHK script to EXE file (standalone)
it's usefull convert single sripts to EXE for run manually

Post Reply

Return to “Ask for Help (v2)”