Can three quotes equal a single, smart quote? It’s complicated...

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
d0ugparker
Posts: 1
Joined: 29 Jan 2018, 13:14

Can three quotes equal a single, smart quote? It’s complicated...

05 Dec 2021, 13:16

I searched the forums but didn't find an answer to this question.

Executive summary:
"
= ", a regular double quote
"" [1]
= “, a starting smart double quote
""" [2]
= ”, an ending smart double quote

You can already see the problem. This is okay:

Code: Select all

:*?:"":“
but [1] clears two regular quotes off of the character stream stack, so a character stream stack with three, regular, double quotes [2] can never be reached, triggered, and replaced. The following won't work because of this:

Code: Select all

:*?:""":”
I've also tried

Code: Select all

:*?:“":”
thinking AHK pushes the smart quote it generates onto the character stream stack, but it doesn't. Can a character be added to AHK's stack? Maybe that's the solution. So, I tried using Send, below, to check out its overall, behind-the-scenes manner of operation, below. Spoiler: nope.

This is my current, two, autocorrect hotkey pair, which isn't working the way I'd like it to be working, and yes, I understand the order in which autocorrect rules are listed will affect the resulting replacement pattern:

Code: Select all

:*?:“"::”         ; this doesn't work as I'd like
:*?:""::          ; this three line autocorrect rule works
Send,“            ; I'd hoped Send would have pushed a “ onto the stack
return            ; but it apparently doesn't
How do I write—*can* I write—three, regular, double quotes replaced by one, ending, double smart quote?
User avatar
mikeyww
Posts: 26850
Joined: 09 Sep 2014, 18:38

Re: Can three quotes equal a single, smart quote? It’s complicated...

05 Dec 2021, 13:42

Code: Select all

$"::
SetTimer, Tq, -300
Tq++
Return
Tq:
Send % (SubStr("""“”", Tq, 1), Tq := 0)
KeyWait, "
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: LepG, mapcarter, mikeyww, OrangeCat and 261 guests