-
1. Re: scripting xml map and exporting xml (applescript)
sstanleyau Jun 15, 2010 5:45 PM (in response to IowaBoy9)If your styles are in style groups, you need to use references to them rather than just style names. So roughly:
tell myDocument
set mainHeadStyle to paragraph style "Head_Main" of paragraph style group "HeadStyles"
[...]
make XML export map with properties {markup tag:"chapter", mapped style: mainHeadStyle}
If you're not sure of the groups, you can also use something like:set mainHeadStyle to item 1 of all paragraph styles whose name is "Head_Main"
-
2. Re: scripting xml map and exporting xml (applescript)
IowaBoy9 Jun 16, 2010 5:52 AM (in response to sstanleyau)No love.
Here is the adjusted script.
tell application "Adobe InDesign CS3"
set myDocument to active document
tell myDocument
set myRootXMLElement to XML element 1
set chapter to make XML tag with properties {name:"chapter"}
--more like this.
set chapterStyle to paragraph style "Head_Main" of paragraph style group "HeadStyles"
make XML export map with properties {markup tag:"chapter", mapped style:"chapterStyle"}
--make XML export map with properties {markup tag:"chapterTime", mapped style:"BodyStyles:Main_SuggestedTime"}
map styles to XML tags
export to "test.xml" format "XML"
--save XML tags to "xml_tags.xml"
end tell
end tellHere is the result:
tell application "Adobe InDesign CS3"
get active document
--> document "77913WWPTWEG7_ILC21.indd"
get XML element 1 of document "77913WWPTWEG7_ILC21.indd"
--> XML element id 2 of document "77913WWPTWEG7_ILC21.indd"
make with properties {name:"chapter"} new XML tag
--> XML tag id 37887 of document "77913WWPTWEG7_ILC21.indd"
--items cut from here.
get paragraph style "Head_Main" of paragraph style group "HeadStyles" of document "77913WWPTWEG7_ILC21.indd"
--> paragraph style id 33492 of paragraph style group id 34226 of document "77913WWPTWEG7_ILC21.indd"
make with properties {markup tag:"chapter", mapped style:"chapterStyle"} new XML export map
map styles to XML tags document "77913WWPTWEG7_ILC21.indd"
export document "77913WWPTWEG7_ILC21.indd" to "test.xml" format "XML"
end tellNo export document; no change to the "map Styles to Tags" menu.
??
-
3. Re: scripting xml map and exporting xml (applescript)
IowaBoy9 Jun 16, 2010 7:55 AM (in response to IowaBoy9)You are on to something, however. When I move styles out of a group to the "root" level of the style palette, the script is able to address them. So the issue is one of addressing a style inside a group. Or perhaps it an issue of moving a style outside a group.
-
4. Re: scripting xml map and exporting xml (applescript)
IowaBoy9 Jun 16, 2010 9:21 AM (in response to IowaBoy9)Workaround:
move all styles out of groups using the move command:
move all paragraph styles of paragraph style group "HeadStyles" to end
The rest of the script now works.
-
5. Re: scripting xml map and exporting xml (applescript)
sstanleyau Jun 16, 2010 2:59 PM (in response to IowaBoy9)It won't work wuthout making references to all the styles you use. And you then need to use the references as variables, not strings. So this:
make XML export map with properties {markup tag:"chapter", mapped style:"chapterStyle"}
shouldn't have quotes around chapterStyle.

