how can I use ; ass input key? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 04:57

Hello! I want to use RAlt & ; an input key but AutoHotKey understands ; as a comment.
Is there a way to make ; an input key in combination with RAlt?
Thank you!

User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: how can I use ; ass input key?

Post by mikeyww » 07 Jun 2023, 05:50

You tried it? What happened? Where is your script?

Code: Select all

#Requires AutoHotkey v1.1.33
>!;::MsgBox 123
Explained: Comments

User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

Re: how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 06:20

hello and thank you for replying, but it doesn't work!
here is my script:

Code: Select all

>RAlt & ;::Send("!od")
Still understands ; as a comment

User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: how can I use ; ass input key?

Post by mikeyww » 07 Jun 2023, 06:23

I didn't imply that your script worked, since I didn't know what your script was.

And now for the big question: what happened when you tried my script, by itself with no other code, and no other scripts running?

Read: Escape sequences

User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

Re: how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 06:27

This that I sent before is your script, isn't it?

Code: Select all

>RAlt & ;::Send("!od")
I don’t want to use ! but Ralt with ;

User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

Re: how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 06:32

I’m sorry! I posted my question in the wrong forum. I’m using v2.
Sorry! Is there for version 2 a solution?
Or should I repost my question in v2 forum?

User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: how can I use ; ass input key?  Topic is solved

Post by mikeyww » 07 Jun 2023, 06:33

Please indulge me in a favor. I am interested to know if you would be willing to test the script that I have posted below, to see if it matches your description of your need. Our scripts are not the same, and different scripts may yield different results. That is why I have asked.

Code: Select all

#Requires AutoHotkey v2.0
>!;::MsgBox 123
f & `;::MsgBox 456
The second favor is to know if you could read the Escape sequences section describing the use of `;.
Last edited by mikeyww on 07 Jun 2023, 06:37, edited 2 times in total.

gregster
Posts: 8989
Joined: 30 Sep 2013, 06:48

Re: how can I use ; ass input key?

Post by gregster » 07 Jun 2023, 06:35

entropy wrote:
07 Jun 2023, 06:32
Or should I repost my question in v2 forum?
No need. I moved your topic to v2.

Btw, you probably have heard about modifiers... https://www.autohotkey.com/docs/v2/Hotkeys.htm#Symbols (which are recommended, whenever there can be applied). There is a ! modifier...

User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

Re: how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 06:45

It worked now with `
No I didn’t read the page “Escape sequences”.
None of the search keywords I used trying to find a solution brought me to this page!
I searched for special characters to use as input keys.
Thank you again for your assistance.

User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: how can I use ; ass input key?

Post by mikeyww » 07 Jun 2023, 06:53

I am inferring that you never tried my script. I posted it because it might help you. It's frustrating when the responders' scripts are ignored. It defeats the purpose of the forum.

User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

Re: how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 07:01

mikeyww wrote:
07 Jun 2023, 06:53
I am inferring that you never tried my script. I posted it because it might help you. It's frustrating when the responders' scripts are ignored. It defeats the purpose of the forum.
I don’t understand your reaction!
I did try it and worked. I replied that it worked.
Your first scripts were for v1 and didn’t work because I made the mistake to post my question in the wrong forum.
I apologised for my mistake.
I don’t understand your reaction.

User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: how can I use ; ass input key?

Post by mikeyww » 07 Jun 2023, 07:11

When you wrote, "but it doesn't work!", I think I misinterpreted this, or missed where you described the results of running the script. Sorry if I misunderstood what you wrote.

In any case, the idea here is that you don't need to use RAlt as a prefix key in a custom combination. In most cases, it is better to use !, >!, etc.

User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

Re: how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 07:16

It's alright. I may have not been clear myself.

User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: how can I use ; ass input key?

Post by boiler » 07 Jun 2023, 07:19

For what it’s worth, I also never saw that entropy tried mikeyww’s script, and I also was wondering why he doesn’t just run his script. If the comment “It worked with `” was referring to mikeyww’s script, it was misleading because his script didn’t need the semicolon escaped since it wasn’t preceded by a space. Only entropy’s script need that.

User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

Re: how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 07:29

For what it’s worth too when I posted that it worked, I meant this script: f & `;::MsgBox 456
I said from the beginning that I wanted to use ; with RAlt
Anyway, when misunderstandings are solved, it's like they never existed in the first place :)

User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: how can I use ; ass input key?

Post by boiler » 07 Jun 2023, 08:40

entropy wrote: I said from the beginning that I wanted to use ; with RAlt
And from the beginning, that's exactly what mikeyww's script does. In fact, his method using only modifier symbols to specify RAlt is much preferred to making a custom combination of a modifier key like RAlt using &. You said you didn't want to use !, so perhaps you are not aware that >! means RAlt. You should still consider using his version because it doesn't kill the use of RAlt for other purposes as is the drawback to the custom combination approach in general.

User avatar
entropy
Posts: 93
Joined: 17 Oct 2014, 01:45

Re: how can I use ; ass input key?

Post by entropy » 07 Jun 2023, 09:45

This forum is the only one where I have gotten 100% of my questions answered and my appreciation, especially to mikeyww who helped me enormously in converting my v1 scripts to v2, is huge.

I’m responsible for the misunderstanding because when I was trying to figure out why mickeyww’s solution didn’t work in my script, I noticed this #Requires AutoHotkey v1.1.33.
Then I realised that I'd posted my question in the wrong forum and I didn’t bother to investigate any further.

Adding to this that I had no idea that >! means RAlt you can imagine why I tried this code >RAlt & ;::Send("!od"), which I posted to mikeyww when he asked me the code I used.
I removed from mikeyww’s code the ! believing that > is the key that modifies the ;, and that mikeyww gave me an example for the left Alt which is !.
When later I saw that ` is the modifier for ; you can imagine that the whole thing got worse in my mind.

With your last post, now I know the difference between RAltand >! and this will also help me in the future.

From last posts, Mikeyww knows that I’m ignorant.
Now you know it too.

Thank you both for your assistance.

User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: how can I use ; ass input key?

Post by boiler » 07 Jun 2023, 10:07

No problem. It just seemed like understanding that > meant "right" was the source of the crossed wires, so I thought I'd throw that out there.

User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: how can I use ; ass input key?

Post by mikeyww » 07 Jun 2023, 10:38

Thank you for clarifying, & thank you, boiler, for the additions.

The relevant documentation section to learn about this is cited below.

Hotkey modifier symbols

Post Reply

Return to “Ask for Help (v2)”