scripting indesign

wanya74

Membre confirmé
19 Août 2003
20
0
Salut à tous,

QQ'un sait-il comment on fait pour rentrer une nouvelle "référence de page" dans un index indesign par script "applescript" ?
 
TRY :

<font class="small">Code:</font><hr /><pre>
tell application "InDesign 2.0.2"
set myDocument to make document
tell myDocument

-- début création de l'index
set myIndex to make index
-- fin création de l'index

set myText to "Toto"
set myTextFrame to make text frame
tell myTextFrame
set geometric bounds to {10, 10, 20, 100}
set contents to myText
end tell

-- début entrée d'index
set myOffset to index of paragraph 1 of parent story of myTextFrame
tell myIndex
set myTopicName to myText
try
-- Si l'entrée existe déjà
set myTopic to index topic myTopicName of myIndex
on error
-- Sinon on crée une nouvelle entrée d'index
set myTopic to make topic with data {myTopicName}
end try
tell myTopic
-- Création d'une référence de page
set myPageReference to make page reference with properties {parent story:parent story of myTextFrame, story offset:myOffset}
end tell
end tell
-- fin entrée d'index

end tell
end tell</pre><hr />

END TRY.
tongue.gif
wink.gif