Click the link below to download version 0.0.2 of UnicodeInjector. UnicodeInjector is free to use, and works with InDesign CS3 or higher.
Unzip the .zip archive after download. Then follow the installation instructions.
How It Works
This free script will insert a sequence of one or more Unicode characters at the current insertion point in InDesign.
This script is configured by renaming a copy of the UnicodeInjector.jsx file.
The idea is that you make one or more copies of this script, rename them according to the desired goal, and place these copies into your scripts folder.
For example, if you rename a copy of this script to:
U+0061 U+0062 Insert Unicode chars.jsx
and copy it into your InDesign Scripts folder, each time you set your text cursor in some text, then double-click the script (or hit a keyboard shortcut if you assign one), it will insert the unicode characters U+0061 and U+0062 (that is, ‘A’ and ‘B’ – it’s a silly example).
Installing and Configuring
Make a duplicate of the UnicodeInjector.jsx file.
Look up the Unicode characters you desire to insert (e.g. assume we want to insert a hair space, U+200A).
Rename the copy of the script so the name contains the desired unicode(s) as well as some descriptive text – e.g. U+200A Insert a hair space.jsx
Move the U+200A Insert a hair space.jsx script to your InDesign Scripts folder.
The easiest way to do that is to start InDesign, then show the Scripts Palette. (It’s under the Window – Automation or Window – Utilities menu).
Right-click or control-click the User entry on the Scripts Palette and select Reveal in Explorer or Reveal in Finder.
In the folder that opens, double-click the Scripts Panel folder so it opens up.
Move the newly renamed script into the Scripts Panel folder.
Go back to InDesign – the script is ready for use.
Position your text cursor by double-clicking in any text frame, then double-click the script name on the Scripts Palette; the unicode character(s) will be inserted in the text.
Keep in mind that unless the font used supports the inserted Unicode, a colored square will show up. If that happens, you might need to change the font (for example, select a Dingbat font).
To assign a keyboard shortcut to the script, go to the Edit – Keyboard Shortcuts… menu. If you have not done so some time before, make a new set by clicking the New Set… button.
If you already have a custom set, feel free to add to that set instead.
Select the Scripts Product Area, and then find your scripts in the list. Assign any keyboard shortcuts as desired.
Repeat this procedure as many times as needed – you can have as many copies of this script as you want.
This script will ignore any descriptive text in the file name. So in the first example, the text Insert Unicode chars is ignored – only the U+0061 and U+0062 is interpreted.
The script understands the following notations:
U+nnnn (U, +, then 1 to 4 hexadecimal digits) Examples: U+0041, u+20eF, u+61
0xnnnn (zero, x, then 1 to 4 hexadecimal digits) Examples: 0x0041, 0x20Ef, 0X61
0dnnnnn (zero, d, followed by 1 to 5 decimal digits) Examples: 0d65, 0d8431, 0D97
A copy of the script whose filename is Insert the letter a with code 0d65.jsx will insert the letter ‘a’, as it contains 0d followed by a decimal number 65.
You might need to insert spaces when using multiple codes and 0x or 0d notation.
For example, 0x61 0x61 will insert two 0x61 codes, whereas 0x610x61 without space inbetween will insert a single 0x610 code, and will ignore the x61.
Where To Find Unicode Character Codes?
There are many sources. Google is your friend. But you can start by consulting the following downloadable text file:
Example: you can find the following line:
... 200A;HAIR SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; ...
This means that to insert a hair space, the hexadecimal code is 200A. Prefix that code with U+ and put it into the script name. So, you’d rename your script file to something similar to U+200A Insert a hair space.jsx.
Then copy it into the Scripts Palette, double click it to insert a hair space.
Hope you like it! Please send feedback to [email protected]
We want this script to serve as an advertisement for Rorohiko.
We automate the Creative Suite, in projects both large and small. We also have a solid track record in teaching other people how to build stable, dependable, yet flexible solutions.
If you have a need for automation or need some fast-tracking, contact us. We’ve been building solutions around the Creative Suite and InDesign Server for many years now.
Our motto is: “If you only have a hammer, everything looks like a nail”. What sets us apart is a very wide experience, so we can pick the right tool for the task at hand.
To name just a few of the environments we use on a regular basis: ExtendScript, ActionScript, Flex/Flash Builder, InDesign, Acrobat, XML, GWT, Java, jQuery, PHP, C++, HTML, CSS, SOAP, Eclipse, REALbasic, SharePoint, Visual Basic, Mac, Windows, Linux, Tomcat, SOAP, SVN, TRAC.