🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18987

Re: How to work around a bug? [AS]

#18987
From: Shane Stanley
Date: Wed, 12 Feb 2003 10:28
45 lines
2447 bytes
On 12/2/03 6:29 PM +1000, Richard Ronnback, richard.ronnback@telia.com,
wrote:

> I made a script to change the applied language of every story on a layer and
> it works, but only if the selected language has been applied somewhere in the
> document before I run the script. I assume it is the same bug that prevents
> you from making a paragraph style with a different language (unless the
> language is already applied somewhere in the document)
> 
> Any ideas how to work around this bug?

I played around with this a while ago, and the only workaround I could come
up with was to make a tagged file that uses the language, place it, do your
search, and then delete the file.

Here's the code, which I never got around to testing:

tell application "InDesign 2.0.2"
 set theStory to my forceLanguage(newLangname)
 -- do stuff
 delete parent of insertion point 1 of theStory
end tell

on forceLanguage(newLangname)
 set thePath to path to startup disk as string
 set theData to "<ASCII-MAC>
<Version:2.000000><FeatureSet:InDesign-Roman><ColorTable:=<Black:COLOR:CMYK:
Process:0.000000,0.000000,0.000000,1.000000>>
<ParaStyle:>x <cLanguage:" & newLangname & ">y<cLanguage:> z"
 set fileRef to (open for access file (thePath & "Temptag.txt") with write
permission)
 set eof fileRef to 0
 write theData to fileRef
 close access fileRef
 tell application "InDesign 2.0.2"
  set theStory to place (thePath & "Temptag.txt") on page 1 of document 1
 end tell
 tell application "Finder"
  delete file (thePath & "Temptag.txt")
 end tell
 return theStory
end forceLanguage

-- 
Shane Stanley,  sstanley@myriad-com.com.au
Technical Details
Message-ID: <BA706D14.4D83C%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de7d137.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,f18047cf404d6b6c
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-02-12 02:38:07 PST
From: Shane Stanley <sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: How to work around a bug? [AS]
Message-ID: <BA706D14.4D83C%sstanley@myriad-com.com.au>
Date: Wed, 12 Feb 2003 02:28:52 -0800
References: <1de7d137.-1@WebX.la2eafNXanI>
Lines: 57
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