Go Back   The macosxhints Forums > OS X Help Requests > System



Reply
 
Thread Tools Rating: Thread Rating: 12 votes, 5.00 average. Display Modes
Old 11-13-2006, 05:55 PM   #1
spydr
Triple-A Player
 
Join Date: Sep 2005
Posts: 55
shortcuts for inserting greek characters

Hi,
I have to insert a few greek characters in my text documents in a regular basis - alpha, beta, gamma and mu. I know and "option+m" types 'µ' but I have not found any such easy key combinations to type the other characters that I need. Currently I am either toggling to greek keyboard for the character or pulling it from character palette. Both these options are not as elegant as simple key combinations to get what I need and keep moving. If someone know how I can 'remap' "option+a" for alpha, "option+b" for beta and "option+g" for gamma, I would greatly appreciate it.
Thanks
spydr is offline   Reply With Quote
Old 11-14-2006, 10:52 AM   #2
NovaScotian
League Commissioner
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 5,156
Quote:
Originally Posted by spydr
Hi,
I have to insert a few greek characters in my text documents in a regular basis - alpha, beta, gamma and mu. I know and "option+m" types 'µ' but I have not found any such easy key combinations to type the other characters that I need. Currently I am either toggling to greek keyboard for the character or pulling it from character palette. Both these options are not as elegant as simple key combinations to get what I need and keep moving. If someone know how I can 'remap' "option+a" for alpha, "option+b" for beta and "option+g" for gamma, I would greatly appreciate it.
Thanks

I run this little AppleScript, which places the chosen character in the clipboard

Code:
set alph to (run script "«data utxt03B1»") as Unicode text
set bet to (run script "«data utxt03B2»") as Unicode text
set gam to (run script "«data utxt03B3»") as Unicode text
set mu to (run script "«data utxt03BC»") as Unicode text

set the clipboard to item 1 of (choose from list {alph, bet, gam, mu})
If you want others, get them from the Character Palette
__________________
17" MBP, OS X; 27" iMac, both OS X 10.10.x (latest)

Last edited by NovaScotian; 11-14-2006 at 11:00 AM.
NovaScotian is online now   Reply With Quote
Old 11-14-2006, 12:16 PM   #3
spydr
Triple-A Player
 
Join Date: Sep 2005
Posts: 55
Quote:
Originally Posted by NovaScotian
I run this little AppleScript, which places the chosen character in the clipboard

Code:
set alph to (run script "«data utxt03B1»") as Unicode text
set bet to (run script "«data utxt03B2»") as Unicode text
set gam to (run script "«data utxt03B3»") as Unicode text
set mu to (run script "«data utxt03BC»") as Unicode text

set the clipboard to item 1 of (choose from list {alph, bet, gam, mu})
If you want others, get them from the Character Palette

Thanks for the reply.
I am not entirely sure how I would implement this script. Do I have to run the script everytime I need to place the character? Or if I run the script before writing all the relevant characters would be available in the clipboard so whenver I type 'alph' it would 'autocorrect' itself to 'alpha symbol'?

Ideally I am looking to change the keybindings from so I can type option+character to type the corresponding greek character. So this way I can keep typing without interrupting my flow.

Thanks for the inputs anyway.
spydr is offline   Reply With Quote
Old 11-14-2006, 12:33 PM   #4
NovaScotian
League Commissioner
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 5,156
Bad idea to change key bindings (and I'm not sure how you would do it except by fooling around with the font).

There are a number of ways to do accomplish what you want to do, though. If the word processor you use has a script menu, put it there.

If you own and use CopyPaste, it enables the creation of clip sets in one of which you'd put the four symbols and then they'd be used by holding command-v and then typing 1, 2, 3, 4 to paste one of them at the insertion point in your document (the way I do it).

If you own and use FastScripts, then you can assign a hot key for the script (or make it four scripts) and then get it with hot-key followed by command-v.

There are probably other options, but these are the ones I use.
__________________
17" MBP, OS X; 27" iMac, both OS X 10.10.x (latest)
NovaScotian is online now   Reply With Quote
Old 11-14-2006, 12:39 PM   #5
JDV
Hall of Famer
 
Join Date: Sep 2004
Location: Chicago, Illinois
Posts: 3,191
Out of curiosity, what text editor do you use? It might be easier to do it using the features of the editor, unless you need it more broadly than that.

Joe VanZandt
JDV is offline   Reply With Quote
Old 11-14-2006, 01:02 PM   #6
spydr
Triple-A Player
 
Join Date: Sep 2005
Posts: 55
Quote:
Originally Posted by JDV
Out of curiosity, what text editor do you use? It might be easier to do it using the features of the editor, unless you need it more broadly than that.

Joe VanZandt

I use word for writing my manuscripts but I do see routine use in other apps that use cocoa text system(textedit, Notebook, devonthink etc). That is why I am looking for a system wide shortcut.
spydr is offline   Reply With Quote
Old 11-14-2006, 01:16 PM   #7
spydr
Triple-A Player
 
Join Date: Sep 2005
Posts: 55
Quote:
Originally Posted by NovaScotian
Bad idea to change key bindings (and I'm not sure how you would do it except by fooling around with the font).

I do share that concern - but it seemed to me as a way to get it to work broadly in many apps. I wonder if someone has used KBE to accomplish something like that.

Copypaste appears to be a promising second option. But I am not sure if I want to spend $30 for it.
spydr is offline   Reply With Quote
Old 11-14-2006, 01:19 PM   #8
JDV
Hall of Famer
 
Join Date: Sep 2004
Location: Chicago, Illinois
Posts: 3,191
Here's a program that might do what you want for not too much money: http://www.macility.com/products/popcharx/

Joe VanZandt
JDV is offline   Reply With Quote
Old 11-14-2006, 02:13 PM   #9
spydr
Triple-A Player
 
Join Date: Sep 2005
Posts: 55
Quote:
Originally Posted by JDV
Here's a program that might do what you want for not too much money: http://www.macility.com/products/popcharx/

Joe VanZandt

Thanks. I will give it a spin — I am still hopeful that it has got to be possible without having to run an entire application just for it!
spydr is offline   Reply With Quote
Old 11-14-2006, 02:38 PM   #10
JDV
Hall of Famer
 
Join Date: Sep 2004
Location: Chicago, Illinois
Posts: 3,191
You know, in DOS/Windows it is possible to produce higher ascii characters from the contol key (alt key? I don't remember!) and the correspoding ascii number on the numeric keypad. Does anyone know if there is any corresponding function in OS X?

Joe VanZandt
JDV is offline   Reply With Quote
Old 11-14-2006, 02:55 PM   #11
biovizier
All Star
 
Join Date: May 2004
Location: london on ca
Posts: 930
The "Unicode Hex Input" input method ("System Preferences" > "International" > "Input Menu") might be the sort of thing you are referring to. The unmodified or shifted keystrokes are pretty much the same as the Canadian or US English layout, plus by holding down the "option" key and typing in the unicode value (eg 03b1, o3b3, etc.), arbitrary characters can be inserted. However, the downside is that that layout doesn't include the standard "option"-key characters, such as "option"-s for beta, option-8 for a bullet, etc. that you may have come to rely on. However, the "Unicode Hex Input.keylayout" file is one that is plain-text XML so it might be easy to customize to get the best of both...

Edit: Some customization of the file does seem to work, by adding in your choice of "option"-key mappings under the index="3" section. I didn't bother to test it, but since the "option" key is used for hex input, I would imagine that assigning custom characters to any "option" combination involving [0-9,a-f] would be a bad idea. Edit a copy of the "/System/Library/Keyboard Layouts/Unicode.bundle/Contents/Resources/Unicode Hex Input.keylayout" file, rename it, put it in the "~/Library/Keyboard Layouts" folder, log out and back in, then enable it from the pref pane.

Last edited by biovizier; 11-14-2006 at 03:22 PM.
biovizier is offline   Reply With Quote
Old 11-14-2006, 03:24 PM   #12
JDV
Hall of Famer
 
Join Date: Sep 2004
Location: Chicago, Illinois
Posts: 3,191
That certainly sounds like the same sort of thing; the ascii codes were decimal values, because they didn't use unicode (at that time). It may be that the OP can find some way to make use of that information to create an action that would invoke that in some way. It doesn't seem on the surface that it ought to be difficult.

Joe VanZandt
JDV is offline   Reply With Quote
Old 11-14-2006, 09:55 PM   #13
spydr
Triple-A Player
 
Join Date: Sep 2005
Posts: 55
Thanks everyone for their inputs.

The most elegant solution I have come across so far is the one from Jacob Rus on customizing cocoa text system. This involves making a simple 'DefaultKeyBinding.dict' file at ~/Library/KeyBindings/
Here is one such .dict file I made with his code.

1. Drop the .dict file at above path (make the KeyBindings folder if necessary—I had to)
2. As it is set right now, the letter typed after hitting ^b will be typed as a greek alphabet. It automatically inserts the correct font variant as per the body of the text. After one greek character, it reverts back automatically so you can resume typing as usual. As you might imagine, this works for any and all cocoa application.
Great for greek symbol insertions while typing, without having to mouse around to the character palette or having an extra software to accomplish it.

PS: Here is the code is you want to look at it.
Attached Files
File Type: zip DefaultKeyBinding.dict.zip (1.4 KB, 413 views)

Last edited by spydr; 11-14-2006 at 10:01 PM.
spydr is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 03:41 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.