2017-01-25 10 views
0

Я работаю с InDesign и XML, и мне нужно, если это возможно, чтобы связать элемент XML в рамках InDesign и получить положение этогоAppleScript ассоциировать XML-элемент для Indesign кадра

с AppleScript это мой просто код

tell application "Adobe InDesign CC" 
set myDocument to active document 
tell myDocument 
    set myTag to XML tag "aa" 

    tell XML element 1 
     set elementCount to (get count of XML Items) 
     repeat with x from 1 to elementCount 
      set elem1 to XML element x 
      tell contents of elem1 
       set tag to value of XML attribute "ean" of elem1 
      end tell 
      select elem1 

      /* here I try */ 
      set rettangolo to contents of elem1 
      return geometric bounds of rettangolo as string 

     end repeat 
    end tell 

и этот сценарий, чтобы получить позицию, когда я выбираю кадр из Indesign

set myDocument to active document 
tell myDocument 
    set rettangolo to properties of item 1 of selection 
    set coordina to geometric bounds of rettangolo as string 
    display dialog coordina 
end tell 

Как связать элемент первого сценария к кадру?

ответ

3

tell application "Adobe InDesign CC 2017" 
 
\t set myDocument to active document 
 
\t tell myDocument 
 
\t \t tell XML element 1 
 
\t \t \t set elementCount to (get count of XML Items) 
 
\t \t \t repeat with x from 1 to elementCount 
 
\t \t \t \t set elem1 to XML element x 
 
\t \t \t \t tell myDocument 
 
\t \t \t \t \t set myTag to XML tag (value of XML attribute "ean" of elem1 as string) 
 
\t \t \t \t \t set markup tag of elem1 to myTag 
 
\t \t \t \t \t set myStory to parent story of elem1 
 
\t \t \t \t \t set tf to item 1 of text containers of myStory 
 
\t \t \t \t \t set gbs to geometric bounds of tf as string 
 
\t \t \t \t \t display dialog gbs 
 
\t \t \t \t end tell 
 
\t \t \t end repeat 
 
\t \t end tell 
 
\t end tell 
 
end tell

Вы должны рассмотреть Javascript;)