Adding Quotations to AutoCorrect Script Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Whazzzzzup15
Posts: 41
Joined: 13 Apr 2019, 16:12

Adding Quotations to AutoCorrect Script

16 Nov 2020, 17:47

I have the AutoCorrect Script and I'm trying to allow double capitalized letter for specific keys. I'm trying to add Quotation marks, but running into errors. Is there a specific text I should add to enable qutations

Specifically to this line

Code: Select all

keys = ``-=[]\;',./[email protected]#$^&*()_+:  ; ← Can't add " here or it breaks
Loop Parse, keys
   HotKey ~%A_LoopField%, ~Space       ; Special chars to keep 2 capitals before

Full code if needed,

Code: Select all

; 
keys = ``1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./
Loop Parse, keys
   HotKey ~+%A_LoopField%, Hoty        ; Shifted keys to monitor

keys = 1234567890qwertyuiopasdfghjklzxcvbnm
Loop Parse, keys
   HotKey ~%A_LoopField%, Normal       ; Unshifted keys to register as hotkeys

keys = ``-=[]\;',./[email protected]#$^&*()_+:  ;[email protected]#$%^&*()_+
Loop Parse, keys
   HotKey ~%A_LoopField%, ~Space       ; Special chars to keep 2 capitals before

Hoty:
   CapCount := SubStr(A_PriorHotKey,2,1)="+" && A_TimeSincePriorHotkey<999 ? CapCount+1 : 1
   IfEqual CapCount,2, SendInput % "{BS}{"  SubStr(A_ThisHotKey,3,1) "}"
   IfEqual CapCount,3, SendInput % "{Left}{BS}+{" SubStr(A_PriorHotKey,3) "}{Right}"
Normal:
Return

~Shift Up::                            ; Handle CamelCase
   key0 := SubStr(A_PriorHotKey,2,1)="+" && A_TimeSincePriorHotkey<999 && CapCount=2
           ? SubStr(A_PriorHotKey,3) : ""
Return

~Space::                               ; Restore 2 capitals before special chars
   If (key0 <> "" && A_PriorHotKey = "~Shift Up" && A_TimeSincePriorHotkey<999) 
      SendInput % "{Left}{BS}+{" key0 "}{Right}"
Return
User avatar
mikeyww
Posts: 4108
Joined: 09 Sep 2014, 18:38

Re: Adding Quotations to AutoCorrect Script

16 Nov 2020, 18:15

Can you describe "errors" and "it breaks", along with an example of this, and an example of the desired effect? Please also provide the exact script that does not work.
User avatar
boiler
Posts: 6646
Joined: 21 Dec 2014, 02:44

Re: Adding Quotations to AutoCorrect Script  Topic is solved

16 Nov 2020, 19:45

On my US keyboard, the " character is a shifted ' key, so a " hotkey is already covered by this:

Code: Select all

keys = ``1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./
Loop Parse, keys
   HotKey ~+%A_LoopField%, Hoty        ; Shifted keys to monitor
But it's also not causing a problem for me if I add a " right after the : here:

Code: Select all

keys = ``-=[]\;',./[email protected]#$^&*()_+:  ;[email protected]#$%^&*()_+
Loop Parse, keys
   HotKey ~%A_LoopField%, ~Space       ; Special chars to keep 2 capitals before
I don't get an error, and the script re-capitalizes the second letter with or without the above change, which I believe means is working as desired.
Whazzzzzup15
Posts: 41
Joined: 13 Apr 2019, 16:12

Re: Adding Quotations to AutoCorrect Script

16 Nov 2020, 20:05

boiler wrote:
16 Nov 2020, 19:45
On my US keyboard, the " character is a shifted ' key, so a " hotkey is already covered by this:

Code: Select all

keys = ``1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./
Loop Parse, keys
   HotKey ~+%A_LoopField%, Hoty        ; Shifted keys to monitor
But it's also not causing a problem for me if I add a " right after the : here:

Code: Select all

keys = ``-=[]\;',./[email protected]#$^&*()_+:  ;[email protected]#$%^&*()_+
Loop Parse, keys
   HotKey ~%A_LoopField%, ~Space       ; Special chars to keep 2 capitals before
I don't get an error, and the script re-capitalizes the second letter with or without the above change, which I believe means is working as desired.
I couldn't figure it out on your second part of the code, but removing the quotes from the top did the trick

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, alexsu, Bing [Bot], famko, Google [Bot], Muzzy and 39 guests