Article View: adobe.scripting.indesign
Article #1127[CS3 AS] Tagging text (xml)
From: SuperMacGuy
Date: Tue, 17 Feb 2009 20:46
Date: Tue, 17 Feb 2009 20:46
30 lines
1907 bytes
1907 bytes
Does anyone have any tricks to tag some text objects? I don't fully understand all the intricacies of xml items. I need to apply a tag to a text string in several text frames. The text is already there, and I want to tag it as an xml item, for exporting later. I can make the tag before hand, in fact I'd like to make the tag before hand, and be able to use the same tag on several objects.
So for example we have a date "2-14-09" and want to tag it as "theDate". I've looked and XML suite and I'm seeing a "markup" command. If I have a tag "theDate" how would I apply that to some text in a frame?
If I do it manually I can select some text, and select the tag from the pallet, and it puts a default "Story" object inside root.
Thanks,
Chris
Here's a script I'm trying without success:
tell application "Adobe InDesign CS3"
tell document 1
set myRootXMLElement to XML element 1
set myXMLTag to (get XML tag "theDate")
set myXMLStoryTag to (get XML tag "Story")
tell myRootXMLElement
set theStoryElement to make XML element with properties {markup tag:myXMLStoryTag}
tell theStoryElement
set myXMLElement to make XML element with properties {markup tag:myXMLTag}
end tell
end tell
tell text frame 1
tell word 2
markup using myXMLElement
end tell
end tell
end tell
end tell
Technical Details
Message-ID:
<59b7f76a.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,64f1cae7acd6e0f6,start X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: SuperMacGuy@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: [CS3 AS] Tagging text (xml) Message-ID: <59b7f76a.-1@webcrossing.la2eafNXanI> Date: Tue, 17 Feb 2009 12:46:58 -0800 Lines: 40 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit