Article View: adobe.scripting.indesign
Article #14744Re: AS: How to set a value from some story?
From: Tomi_Saloniemi
Date: Tue, 20 Jan 2004 07:29
Date: Tue, 20 Jan 2004 07:29
35 lines
2379 bytes
2379 bytes
Okay, got it to work somehow. Is there a better way to address the story from which the script searches and replaces items? It is always a story which is imported last.
Also i'm stuck when the document has to move to next page. Can't figure out how to tell ID to change page at the right moment. The rectangle is created on the start page but ID moves to the next page when all searches on start page are done.
After that it can't select myrectangle 'cause it's on the previous page.
tell application "InDesign 2.0.2"
set find preferences to nothing
set change preferences to nothing
tell active document
set myStartItems to search for "[IMAGE]"
set myEndItems to search for "[END]"
set myStory to parent story of last text frame
repeat with myCounter from 1 to (count myStartItems)
set myStartItems to search for "[IMAGE]"
set myEndItems to search for "[END]"
set myStartItem to object reference of item 1 of myStartItems
set myEndItem to object reference of item 1 of myEndItems
set myStartIndex to (index of character -1 of myStartItem) + 1
set myEndIndex to (index of character 1 of myEndItem) - 1
set myimage to characters myStartIndex through myEndIndex of myStory
tell characters (myStartIndex - 7) through (myEndIndex + 5) of myStory to delete
set myRectangle to make rectangle with properties {content type:graphic, geometric bounds:{20.0, 20.0, 70, 105}}
try
tell myRectangle
place "omakova:auto:" & myimage as string
fit given center content
end tell
end try
select myRectangle
cut clipboard
select insertion point (myStartIndex - 7) of myStory
paste
end repeat
end tell
end tell
Technical Details
Message-ID:
<2ccf74c7.1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2ccf74c7.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,7a8aba170806d376 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-19 23:37:39 PST From: Tomi_Saloniemi@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: AS: How to set a value from some story? Message-ID: <2ccf74c7.1@webx.la2eafNXanI> Date: Mon, 19 Jan 2004 23:29:12 -0800 References: <2ccf74c7.-1@webx.la2eafNXanI> Lines: 43 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit