Article View: adobe.scripting.indesign
Article #19529Re: Changing text kerning
From: Shane Stanley
Date: Mon, 16 Dec 2002 00:37
Date: Mon, 16 Dec 2002 00:37
42 lines
2646 bytes
2646 bytes
in article 1de70063.-1@WebX.la2eafNXanI, Rich Carroll wrote:
> I am attempting to create an InDesign version of Quarks extension called
> "Kerning Palette" using Applescipt. Basically the script gets the kerning
> value of the current insertion point, selects the pair of characters wrapped
> around the insertion point, and applys the new kerning value to any other
> instances of the character pairs. The problem I have is that the replacing is
> deleting all the text.
You have a few problems there, and you're probably doing more work than you
have to. And your method of coercing a record to a list is fraught with
peril.
In the search line, you specify "document" instead of "document 1", and your
property names are incorrect. And you'll have trouble changing the kerning
values without also changing the kerning method.
Try playing with something like this:
tell application "InDesign 2.0.2"
set x to item 1 of selection
set kerningValue to kerning value of x
set theIndex to index of x
set charContents to characters (theIndex - 1) thru theIndex of parent story
of x
set charFontStyle to font style of x
set CharFontSize to point size of x
set charFont to applied font of x
set find preferences to nothing
set change preferences to nothing
search document 1 for charContents with find attributes {applied
font:charFont, point size:CharFontSize, font style:charFontStyle} with
change attributes {kerning method:"Manual", kerning value:kerningValue}
end tell
Now a question for the ID experts: How do you enter a search like this
manually in the UI? I can't see how you can enter a manual kerning value,
yet it shows up under "Change Format Settings" in the dialog when the above
script has been run.
--
Shane Stanley, sstanley@myriad-com.com.au
Technical Details
Message-ID:
<BA236B5C.47D45%sstanley@myriad-com.com.au>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de70063.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,3bc2053af32b20a2 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-12-15 16:37:30 PST From: Shane Stanley <sstanley@myriad-com.com.au> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!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: Re: Changing text kerning Message-ID: <BA236B5C.47D45%sstanley@myriad-com.com.au> Date: Sun, 15 Dec 2002 16:37:01 -0800 References: <1de70063.-1@WebX.la2eafNXanI> Lines: 54 User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit