Hi there,
I’m struggling with a very basic issue and can’t seem to work it out.
In Indesign CS5 a word-file is imported in a labeled frame “artikel”.
In this text certain blocks of text are marked with a beginning and ending marker (e.g. [WI] at the start and [\WI] at the end of the text).
This text need to be extracted from frame “artikel” and placed in a different frame.
Problem 1: how do I address the whole imported textstream so I can search for the marked blocks.
So far I only get empty values back. It is clear to me that somehow I’m making a very elementary error.
Problem 2: how do I remove the found block from the main stream.
As you already noticed I’m just a struggling apprentice in this field.
I hope someone can give me some hints so I can proceed my quest.
TIA Erwin
tell application "Adobe InDesign CS5"
set user interaction level of script preferences to never interact
set myDocument to open templatePath
set myPage to page 1 of myDocument
set myTextFrame to text frame 1 of myPage whose label is "artikel"
tell insertion point -1 of myTextFrame
place importFile without showing options
end tell
--set the cursor at start ...
select insertion point 1 of myTextFrame
set myText to (text 1 of myTextFrame) as string
set kaderText to ""
set vergaar to false
set myText2 to (every paragraph of parent story of myTextFrame)
repeat with i from 1 to (count of items in myText2)
set myParagraph to (characters 1 thru -2 of (item i of myText2)) as text
display dialog myParagraph -- for debugging
if myParagraph is "[\\WI]" then
exit repeat
end if
if vergaar then
set kaderText to kaderText & return & myParagraph
end if
if myParagraph is "[WI]" then
set vergaar to true
end if
end repeat
display dialog kaderText
end tell