How to replace Ctrl+r Ctrl+r with F2?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
herve49
Posts: 4
Joined: 06 Apr 2023, 23:59

How to replace Ctrl+r Ctrl+r with F2?

Post by herve49 » 28 Nov 2023, 08:10

Hello,
I'm using Visual Studio 2022 and I use to rename a symbol by typing F2, this is done, in Visual Studio 2022 by typing, two times, Ctrl+R, but I can't succeed to do it.
This is what I tryed:

Code: Select all

F2::{
   Send "{Ctrl}r{Ctrl}r"
}
[Mod edit: + [code][/code] tags.]

Thank you for any help

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

Re: How to replace Ctrl+r Ctrl+r with F2?

Post by gregster » 28 Nov 2023, 08:16

Your code doesn't modify r, but releases Ctrl already before r gets sent. Try instead:

Code: Select all

F2::Send "^r^r"
Alternatively, you could also try {Ctrl down}r{Ctrl up} to send Ctrl and r.

herve49
Posts: 4
Joined: 06 Apr 2023, 23:59

Re: How to replace Ctrl+r Ctrl+r with F2?

Post by herve49 » 29 Nov 2023, 02:32

Thank you very much it runs perfectly.

Post Reply

Return to “Ask for Help (v2)”