Article View: adobe.scripting.indesign
Article #15950Entering Unicode Characters in InDesign CS
From: Olav_Kvern
Date: Wed, 05 Nov 2003 23:06
Date: Wed, 05 Nov 2003 23:06
31 lines
2340 bytes
2340 bytes
Gang--
I'm not sure if this will work with the forum software, but here goes.
In InDesign 2.x, you could enter Unicode characters by using a string in the form "<nnnn>" (where "nnnn" is the Unicode code for the character you want). In InDesign CS, in VBScript and JavaScript, you enter the characters as Unicode and save your file as Unicode text. You can still use the Unicode strings in AppleScript.
What I'm mostly curious about is: will the Unicode characters appear on the forum pages? Let's test it!<g> Here's an InDesign CS JavaScript that enters some Unicode characters:
//JavaScriptUnicodeExample.js
//The old way--using Unicode strings (this does not work in InDesign CS JavaScript):
//var myString = "<5B87><5B99><306E><30B9><30C6><30EB><30F4><38A3><30A2>";
//The new way--using Unicode characters (make sure you save the script as Unicode text):
var myString = "�F���̃X�e�����B�A\rstellvia of the stars";
var myFont = app.fonts.item("Kozuka Gothic Pro\tM");
var myDocument = app.documents.add();
var myX1 = myDocument.pages.item(0).marginPreferences.left;
var myY1 = myDocument.pages.item(0).marginPreferences.top;
var myX2 = myDocument.documentPreferences.pageWidth - myDocument.pages.item(0).marginPreferences.right;
var myY2 = myDocument.documentPreferences.pageHeight - myDocument.pages.item(0).marginPreferences.bottom;
var myTextFrame = myDocument.pages.item(0).textFrames.add(undefined, undefined, undefined, {contents:myString, geometricBounds:[myY1, myX1, myY2, myX2]})
myTextFrame.parentStory.properties = {appliedFont:myFont, pointSize:48, justification:Justification.centerAlign, leading:72};
So...can you see them?
Thanks,
Ole
Technical Details
Message-ID:
<2cce3bc9.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,477cd82366b5505d,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-11-05 15:08:26 PST From: Olav_Kvern@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Entering Unicode Characters in InDesign CS Message-ID: <2cce3bc9.-1@webx.la2eafNXanI> Date: Wed, 5 Nov 2003 15:06:03 -0800 Lines: 41 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit