hotkey replacement, but with two of same letter Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
theleetbeagle
Posts: 43
Joined: 20 Apr 2020, 14:29

hotkey replacement, but with two of same letter

Post by theleetbeagle » 02 Feb 2023, 10:25

would like "ss" (no quotes) to be replaced with s: {backspace}

::ss::s:

works, but gives me a space

:*:ss:s:

doesn't work because it messes up words like pass and crass

Basically, I want to open the windows Run box and type ss, get it automatically changed to s: with no spaces, so that I can immediately follow it with a \ if I want the slash. Sometimes I do, sometimes I don't.

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

Re: hotkey replacement, but with two of same letter

Post by mikeyww » 02 Feb 2023, 10:29

Code: Select all

#Requires AutoHotkey v1.1.33
#If WinActive("ahk_class #32770 ahk_exe explorer.exe")
:*:ss::s: {BS}
#If

Code: Select all

#Requires AutoHotkey v2.0
#HotIf WinActive("ahk_class #32770 ahk_exe explorer.exe")
:*:ss::s: {BS}
#HotIf

theleetbeagle
Posts: 43
Joined: 20 Apr 2020, 14:29

Re: hotkey replacement, but with two of same letter

Post by theleetbeagle » 02 Feb 2023, 10:36

mikeyww wrote:
02 Feb 2023, 10:29

Code: Select all

#Requires AutoHotkey v1.1.33
#If WinActive("ahk_class #32770 ahk_exe explorer.exe")
:*:ss::s: {BS}
#If

Hi, I tried this before, but it keeps the space.

As written, ss{space} gives me "s: "

So I tried adding two {BS}

Then, ss{space} gives me "S "

The run box was just an example. I'd like to use it everywhere. I don't want to use :*:, but :: requires the spacebar to fire it, but I don't want the resultant space.

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

Re: hotkey replacement, but with two of same letter

Post by mikeyww » 02 Feb 2023, 10:54

When I tested the exact script that I posted, it does not keep the space. Use only this code, no other code, no other scripts.

theleetbeagle
Posts: 43
Joined: 20 Apr 2020, 14:29

Re: hotkey replacement, but with two of same letter

Post by theleetbeagle » 02 Feb 2023, 11:02

mikeyww wrote:
02 Feb 2023, 10:54
When I tested the exact script that I posted, it does not keep the space. Use only this code, no other code, no other scripts.
I got it.

Follow-up question. If ever I do want to have a double S typed and displayed, what's the easiest way to get it, while also keeping that hotkey running?

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

Re: hotkey replacement, but with two of same letter

Post by mikeyww » 02 Feb 2023, 11:12

The question is how you would like to get it, what you would like to do, to yield that result.

theleetbeagle
Posts: 43
Joined: 20 Apr 2020, 14:29

Re: hotkey replacement, but with two of same letter

Post by theleetbeagle » 02 Feb 2023, 13:12

mikeyww wrote:
02 Feb 2023, 11:12
The question is how you would like to get it, what you would like to do, to yield that result.
Hi, again,

I occasionally have to type "ssp" - currently the script converts to s:\ before I can get the "p" in.

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

Re: hotkey replacement, but with two of same letter

Post by mikeyww » 02 Feb 2023, 13:15

You have provided a description of the problem, but not an answer to the question. I suggest that you provide a written description of what you would like to type to get output #1, and what you would like to type differently to get output #2.

theleetbeagle
Posts: 43
Joined: 20 Apr 2020, 14:29

Re: hotkey replacement, but with two of same letter

Post by theleetbeagle » 02 Feb 2023, 13:29

mikeyww wrote:
02 Feb 2023, 13:15
You have provided a description of the problem, but not an answer to the question. I suggest that you provide a written description of what you would like to type to get output #1, and what you would like to type differently to get output #2.
Hi, instead of typing "ss" to get "s:" I would like:

to type "ss[space]" to get exactly "s:\" (this is a bit different than what I originally wrote, but is what I want now)

But if ever I need to type "ssp" I would like to be able to do so.

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

Re: hotkey replacement, but with two of same letter  Topic is solved

Post by mikeyww » 02 Feb 2023, 14:04

Code: Select all

#Requires AutoHotkey v1.1.33
:O:ss::s:\

theleetbeagle
Posts: 43
Joined: 20 Apr 2020, 14:29

Re: hotkey replacement, but with two of same letter

Post by theleetbeagle » 02 Feb 2023, 14:12

mikeyww wrote:
02 Feb 2023, 14:04

Code: Select all

#Requires AutoHotkey v1.1.33
:O:ss::s:\


YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!

Post Reply

Return to “Ask for Help (v1)”