tags:

views:

110

answers:

3

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

Has anyone seen any code that does this sort of thing?

EDIT: Okay I've seen some documentation and managed to get it detecting the double shift+3 press like this:

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

But can't get it to send the $ for some reason. Any ideas?

EDIT:

Okay I got the intended functionality working eventually:

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

Basically, when you press Shift+4 the dollar is printed. If you're still holding shift and you press 4 again, the backspace key is pressed and the £ is printed.

A: 

As in http://www.autohotkey.com/docs/KeyList.htm#SpecialKeys, you should put key name into " ".

 KeyWait, "3"
Mikulas Dite
Nope, no luck with that.
AndrewVos
A: 

Does this work?

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
A: 

Answered my own question.

AndrewVos