Jump to content

Recommended Posts

Posted

G'day everyone

I'm trying to write a script to type special characters (e.g. non-breaking space, en dash, etc) via shortcuts.  When I test the Unicode characters using e.g. Send ("{ASC 0160}"), it sends the correct character, but when I try to use this in a script with hotkeys, the hotkeys do not cause anything to be sent.

HotKeySet("+^{SPACE}", "nonbreakspace")
HotKeySet("^{NUMPADSUB}", "endash")
HotKeySet("^-", "hyphdash")
HotKeySet("!^.", "ellips")

While 1
    Sleep(100)
WEnd

Func nonbreakspace()
Send ("{ASC 0160}")
EndFunc

Func endash()
Send ("{ASC 0150}")
EndFunc

Func hyphdash()
Send ("{ASC 0150}")
EndFunc

Func ellips()
Send ("{ASC 0133}")
EndFunc

Can anyone see what I'm doing wrong here, or does Send {ASC} simply not work with hotkeys?

Thanks

Samuel

 

  • Moderators
Posted

@leuce I believe you are hitting an issue with Send trying to operate before your hotkeys have finished fully. This works just fine for me; you'll have to find the sweet spot:

HotKeySet("^-", "Test")

while 1
    sleep(100)
WEnd

Func Test()
    Sleep(500)
    Send("{ASC 0150}")
EndFunc

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...