AutoHotkey Community

It is currently May 26th, 2012, 10:08 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: May 18th, 2005, 11:06 am 
Offline

Joined: May 18th, 2005, 11:03 am
Posts: 30
First of all, I've only been using AutoHotkey for a few days, but it's a great little application. I've been getting along with it pretty well, except for inserting ASCII characters using hotstrings.

I have the following working perfectly for getting French accents:

Code:
:?*C:a\::{ASC 0224}
:?*C:a^::{ASC 0226}
:?*C:c/::{ASC 0231}
:?*C:c^::{ASC 0231}
:?*C:e/::{ASC 0233}
:?*C:e\::{ASC 0232}
:?*C:e^::{ASC 0234}
:?*C:i^::{ASC 0238}
:?*C:o\::{ASC 0242}
:?*C:o^::{ASC 0244}
:?*C:u\::{ASC 0249}
:?*C:u^::{ASC 0251}


However, to get unicode characters with code numbers above 255, I'm struggling. For example I want my deliberate misspelling of ohms to give me the capital omega that's used as the ohms resistance symbol for electronics:

Code:
:*C:ohmss::{ASC 937}


But this gives me the registered copyright symbol ® instead. I've got the number from converting the hexadecimal code (03A9) for the symbol given in OpenOffice. So obviously I'm missing something here?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2005, 12:37 pm 
Please have a look, if "Transform" with "Unicode" helps in this case.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2005, 2:11 pm 
Offline

Joined: May 18th, 2005, 11:03 am
Posts: 30
toralf as guest wrote:
Please have a look, if "Transform" with "Unicode" helps in this case.

Quote the help file:
Quote:
Unicode [, String] [v1.0.24+]: Retrieves or stores Unicode text on the clipboard.

I'm pretty sure it doesn't do what I want to do, as I need to generate Unicode characters, not copy them.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2005, 2:52 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
then you haven't read the manual completly.
Code:
Transform, Clipboard, Unicode, %MyUTF_String% ; Places Unicode text onto the clipboard.


With
Code:
Send, %clipboard%
you can then send the unicode character to the editor/window.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 18th, 2005, 4:20 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
rjwilmsi wrote:
:*C:ohmss::{ASC 937}
But this gives me the registered copyright symbol ® instead.
Strange, I tried that hotstring in Word and another editor and it did yield the ohm symbol. Maybe it's some kind of keyboard layout issue. You could try putting a leading 0 in front of 937.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2005, 7:06 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
This comes up so often that maybe a help section could be devoted to it. See my notes in http://www.autohotkey.com/forum/viewtopic.php?t=3513. The problem is that {ASC 937} is equivalent to pressing Alt-Numpad 9,3,7. This method works for some Windows applications, like MS Word or WordPad, but not being a standard Windows feature, it almost never works elsewhere, like in Notepad, PowerPoint, etc.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2005, 10:26 am 
Offline

Joined: May 18th, 2005, 11:03 am
Posts: 30
Ok, thanks for your help Laszlo and toralf. I've worked out how to do what I want. If anybody else is interested I'm using this code:

Code:
:*C:ohmss::
Transform, Clipboard, Unicode, Ω
Send, ^v
Exit

So when I type ohmss I get the symbol Ω. It seems work in all applications that support display of the symbol (OpenOffice, Firefox, Notepad etc.).

I think it would be really helpful if something like this could be added to the (already very comprehensive) help file, as the {ASC nnnnn} option isn't as universal.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2005, 1:36 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Laszlo wrote:
This comes up so often that maybe a help section could be devoted to it.
Thanks. I've added this valuable info to the Send command's "Send {Asc nnnnn}" section:
Quote:
To generate Unicode characters, specify a number between 256 and 65535 (without a leading zero). However, this is not supported by all applications. Therefore, for greater compatibility and easier sending of long Unicode strings, use "Transform Unicode".

By the way, I haven't forgotten about the ClipboardCore improvement to work around the MS Word bookmark problem you mentioned. It should be done soon, but I'm not sure whether to do it as a new variable (ClipboardCore) or a directive that alters the nature of ClipboardAll for the entire script. A new variable is probably more flexible.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2005, 5:47 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
I used the following script to collect the string equivalents of Unicode characters I often need (before I wrote my own keyboard driver).
Code:
SetFormat Integer, hex
Loop
{
   ClipWait
   Transform ClipUTF, Unicode
   ClipBoard =
   Transform a1, ASC, %ClipUTF%
   StringTrimLeft c2, ClipUTF, 1
   Transform a2, ASC, %c2%
   a2 += 256*a1
   MsgBox %ClipUTF% = %a2%
}
In the Windows character map double-click on the desired symbol and the MsgBox tells the transformed string, which you have to put in the clipboard if you want the Unicode symbol pasted in the application with
Code:
Transform Clipboard, Unicode, %ClipUTF%
Send ^v
I hoped to find a simple relationship between ClipUTF and the Windows code U+xxxx, but I could not find any.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], iBob35555VR, krajan, Yahoo [Bot] and 79 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group