AutoHotkey Script to send pounds (£) by double-pressing Shift + 3

I am trying to make a script that sends a pound instead of a dollar when you hold Shift and quickly press 4.

Has anyone seen any code that does such things?

EDIT: Ok, I saw the documentation and I managed to detect a double shift of + 3, as shown below:

Shift & 4::
if (A_PriorHotkey <> "Shift & 4" or A_TimeSincePriorHotkey > 400)
{
    KeyWait, 4
    return
}
Send, £
return

But he cannot get him to send $ for some reason. Any ideas?

+3
source share
4 answers

I eventually got the target functionality:

Shift & 4::
if (A_PriorHotkey <> "Shift & 4" or A_TimeSincePriorHotkey > 800)
{
    Send, {$}
    return
}
Send, {BS}
Send, £
return

Basically, when you press Shift + 4, a dollar is printed. If you still hold shift and you press 4 again, the backspace key is pressed and a character is printed.

+3
source

?

Shift & 4::
KeyWait, 4  ; waits for '4' to be released
KeyWait, 4, D T.4   ; waits 400ms for 4 to be pressed again
Send %  ErrorLevel ? "{$}" : "{BS}{£}"
    ; if ErrorLevel=1 (4 not pressed) will send $ else will send {BS}£
return
0
source

I did it in a complicated way until I realized that the solution is very simple:

: *: $$ :: £

Just press $ sign twice to get £ (or €)

Btw I did the same for "just click" twice to get "

: *: '' :: "{Space}

It takes a space for me because "it only prints after I press the spacebar (setting the Dutch language).

0
source

Source: https://habr.com/ru/post/1743708/


All Articles