applescript 将 xml 元素关联到 indesign 框架
applescript associate xml element to indesign frame
我正在使用 indesign 和 xml,如果可能的话,我需要将 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
当我 select 来自 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
如何将第一个脚本的元素关联到框架?
tell application "Adobe InDesign CC 2017"
set myDocument to active document
tell myDocument
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 myDocument
set myTag to XML tag (value of XML attribute "ean" of elem1 as string)
set markup tag of elem1 to myTag
set myStory to parent story of elem1
set tf to item 1 of text containers of myStory
set gbs to geometric bounds of tf as string
display dialog gbs
end tell
end repeat
end tell
end tell
end tell
你应该考虑 javascript ;)
我正在使用 indesign 和 xml,如果可能的话,我需要将 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
当我 select 来自 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
如何将第一个脚本的元素关联到框架?
tell application "Adobe InDesign CC 2017"
set myDocument to active document
tell myDocument
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 myDocument
set myTag to XML tag (value of XML attribute "ean" of elem1 as string)
set markup tag of elem1 to myTag
set myStory to parent story of elem1
set tf to item 1 of text containers of myStory
set gbs to geometric bounds of tf as string
display dialog gbs
end tell
end repeat
end tell
end tell
end tell
你应该考虑 javascript ;)