Sign in to follow this  
Followers 0
leuce

Can I use Send {ASC} with hotkeys?

2 posts in this topic

#1 ·  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

 

Share this post


Link to post
Share on other sites



#2 ·  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

 

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0