I'm stuck to hold a specific character. The code does work with letters but doesn't work with apostrophe.

'::
{
pressed:=!pressed
if(pressed)
{
    sendinput,{' down}
}
else
{
    sendinput,{' up}
}
}
return

Does anyone have idea why this isn't working?

up vote 0 down vote accepted

This might happen because you send apostrophe and you use apostrophe as the hotkey. Here is special syntax to avoid the recursive Send command:
https://www.autohotkey.com/docs/Hotkeys.htm#prefixdollar

So you can use the same key but then need to prefix the hotkey with dollar sign $.

This will work:

$'::
    send {' down}
    send {' up}
return

But this will not work:

'::
    send {' down}
    send {' up}
return
  • This solved my problem. TY! – 아아니으 Sep 22 at 0:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.