Article View: adobe.scripting.indesign
Article #17624Re: Inline Frames in Tagged Text
From: Kari Puikkonen
Date: Mon, 26 May 2003 15:33
Date: Mon, 26 May 2003 15:33
76 lines
3141 bytes
3141 bytes
My current project is to design series of the cook books.
In the recipes there are two lines which preceded by picture of the clock - which is an Illustrator file - as inline graphic.
Text is imported as Tagged Text file.
I just could not figure out what is going on in those two Ole's VB scripts...
...but hey, what you know: I managed to make my own script that does the trick!
set firstSearch to "^p Valmistusaika"
set secondSearch to "^p Paistoaika"
set firstReplace to " Valmistusaika"
set secondReplace to " Paistoaika"
tell application "InDesign 2.0.2"
set paraStyle to "InlineStyle"
set myPlacefile to "OS X Disk:Users:karipu:Documents:IlluFile:Clock"
set myStory to object reference of parent story of selection
try
set theParaStyles to name of applied paragraph style of object reference of paragraphs of myStory
repeat with x from 1 to count of theParaStyles
if paraStyle = contents of item x of theParaStyles then
applyRunin(x, myStory, myPlacefile) of me
end if
end repeat
end try
end tell
subroutineREPLACE(firstSearch, secondSearch, firstReplace, secondReplace) of me
on applyRunin(paraNum, storyRef, placeFile)
tell application "InDesign 2.0.2"
repeat
delete characters 1 through -2 of paragraph paraNum of storyRef
select insertion point 1 of paragraph paraNum of storyRef
place placeFile on insertion point 1 of paragraph paraNum of storyRef
exit repeat
end repeat
end tell
end applyRunin
on subroutineREPLACE(firstSearch, secondSearch, firstReplace, secondReplace)
tell application "InDesign 2.0.2"
tell active document
repeat
try
set myFirstChange to search for firstSearch replacing with firstReplace
if myFirstChange = {} then
exit repeat
end if
on error
exit repeat
end try
try
set mySecondChange to search for secondSearch replacing with secondReplace
if mySecondChange = {} then
exit repeat
end if
on error
exit repeat
end try
end repeat
end tell
end tell
end subroutineREPLACE
And it's even pretty fast ; ) How's that!
Seriously; opinions please (for example; if there is even better way to do this).
And I still would have liked to see those two VB scripts written in AppleScript, just to compare mine and Ole's approach...
Kari
Technical Details
Message-ID:
<1de939e0.2@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de939e0.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,2b8d97cfcaa0631e X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-05-26 08:37:58 PST From: "Kari Puikkonen" <kari.puikkonen@welho.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!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: Inline Frames in Tagged Text Message-ID: <1de939e0.2@WebX.la2eafNXanI> Date: Mon, 26 May 2003 08:33:00 -0700 References: <1de939e0.-1@WebX.la2eafNXanI> Lines: 83 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit