Autohotkey for International Financiers
July 29, 2010 7:44 AM   Subscribe

Autohotkey Filter: How do I map ctrl-shift-4 to send the Great British Pound currency symbol to any application?

I know this should be straight forward, but I can't find anything in the documentation on how to send unicode characters.
posted by bluejayway to Computers & Internet (12 answers total) 1 user marked this as a favorite
 
!o::SendInput {£} to have Alt-O send it. That's what Lifehacker had for their example script on how to insert special characters with AHK. Edit the hotkeys as needed because I'm sure Alt-O doesn't make any sense at all for inputting £.
posted by theichibun at 7:51 AM on July 29, 2010


Response by poster: Right, I must be missing something. My US-Windows machine won't display the pound symbol as plain text. I tried creating the .ahk file in Word, inserting the pound symbol and Saving As an .ahk, but I lost the formatting.

Other thoughts? Thank you.
posted by bluejayway at 8:22 AM on July 29, 2010


Best answer: Unicode isn't hard, but is there a reason you're avoiding ASCII, in which £ is #163? If ASCII is okay for you (that is, you're not talking about some strange application that won't accept that particular symbol in ASCII) you can always brute-force it with a script that just does the Windows input code for the £ symbol (which I just used to generate it):

^+4::
Send, {Alt down}
Send, {NumPad0}
Send, {NumPad1}
Send, {NumPad6}
Send, {NumPad3}
Send, {Alt up}
return


I haven't tested this, but I will now. Otherwise, there should be a simpler way; I'll look into it.
posted by koeselitz at 8:27 AM on July 29, 2010


Ah, that works, but apparently windows is really, really slow at interpreting the keystrokes, so you have to put a second or so of sleep time between them.

I'll look around for something else.
posted by koeselitz at 8:30 AM on July 29, 2010


Response by poster: Thank you koeselitz. That worked perfectly. There was no discernible delay either.
posted by bluejayway at 8:39 AM on July 29, 2010


Heh, glad it did. Doesn't work very well here on XP, and keeps sending bogus characters (not sure why) but it's good that it's working.

For what it's worth, this is "brute forcing" because it's already a standard Windows hotkey. You can always type £ by holding down the Alt key and typing 0163 on your numeric keypad.
posted by koeselitz at 8:42 AM on July 29, 2010


Best answer: Argh, I don't know why I didn't just look at the man page for Send.

This is actually really simple. It takes one line. Just do this:

#k::Send,{ASC 0163}

That will send the £ sign.
posted by koeselitz at 8:53 AM on July 29, 2010


(Of course, replace #k in that script with ^+4, so it's triggered by Control-Shift-4 instead of Command-k.)
posted by koeselitz at 8:54 AM on July 29, 2010


Response by poster: Yep, that worked too. And much more elegant. Thanks again!
posted by bluejayway at 9:40 AM on July 29, 2010


This is cool -- could someone please explain how you run that script, and how you bind it to your global hotkey? Thanks.
posted by randomstriker at 11:01 AM on July 29, 2010


Response by poster: randomstriker: This requires you to download and install a free application called Autohotkey. With the application installed, you can do many, many neat things with your Windows system - including mapping hotkeys. The syntax is relatively easy to grasp for simple operations, but the program allows you to do some fairly powerful scripting as well. I'm an absolute novice, but it seems that there are some pretty good resources here as well as on the Autohotkey forum. Good luck!
posted by bluejayway at 11:41 AM on July 29, 2010


Aha! Not having heard of the app, I thought you were using the word "autohotkey" in the generic sense in your original post. Very cool -- thanks!
posted by randomstriker at 12:38 PM on July 29, 2010


« Older O-K-L-A etc   |   Reliable SIP-based GSM Gateway Newer »
This thread is closed to new comments.