Article View: adobe.scripting.indesign
Article #14687[AS] Changing Text Attributes when dealing with strings
From: Jonathan_Hodges
Date: Wed, 21 Jan 2004 14:32
Date: Wed, 21 Jan 2004 14:32
116 lines
2832 bytes
2832 bytes
Hi:
I'm building a script that creates ad templates and includes our slug line at the bottom. Part of the slug info is feed from Filemaker Pro so it enters my script as strings.
For example, the variables adNumber and jobNumber are strings imported from Filemaker and are suppose to show up bold in our slug line:
tell text frame 1
set properties of text frame preferences to {vertical justification:top}
set contents to "Ad No.: " & adNumber & " Job No.: " & jobNumber & (ASCII
character 13) & " "
set properties of paragraph 1 to {justification:center, point size:9,
leading:11, applied font:"Helvetica", font style:"Medium"}
set font style of word 3 of paragraph 1 to "Bold"
set font style of word 6 of paragraph 1 to "Bold"
That works great until the variable has more than a single word. So then I tried character counting, e.g.:
set contents of paragraph 3 to "Description: " & ad_info & (ASCII character
13) & " "
set properties of paragraph 3 to {justification:center, point size:9,
leading:11, applied font:"Helvetica", font style:"Medium"}
set tempNum to number of characters in ad_info
set counter to 14
repeat (tempNum) times
set font style of character counter of paragraph 3 to "Bold"
set counter to counter + 1
end repeat
This works fine, but it's a dog when I'm creating dozens of templates at once.
In my old Quark script, I used to do this:
make new text at end of text box 1 of spread 1 of document 1 with properties
{contents:" Copywriter: ", font:"Helvetica"}
make new text at end of text box 1 of spread 1 of document 1 with properties
{contents:copywriter, font:"B Helvetica Bold"}
Any idea how I can keep adding to a text stream but changing the text properties when they're all on the same line?
Any thoughts would be appreciated.
--jon
Technical Details
Message-ID:
<2ccf7d42.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,2f3cd64b921f09e7,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-21 06:37:49 PST From: Jonathan_Hodges@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: [AS] Changing Text Attributes when dealing with strings Message-ID: <2ccf7d42.-1@webx.la2eafNXanI> Date: Wed, 21 Jan 2004 06:32:51 -0800 Lines: 62 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit