Article View: adobe.scripting.indesign
Article #19228import XML fonctionning ONLY on OS9????
From: Bouchonneau Ludovic
Date: Sun, 12 Jan 2003 22:21
Date: Sun, 12 Jan 2003 22:21
59 lines
3857 bytes
3857 bytes
Hi
I have try somes scripts with "import XML" fonction , but I succed only on OS9... On OSX, a error message say me that "the document don't anderstand the message import XML". I have try on OS9, with ID2.0, 2.0.1, 2.0.2. It s work like a charm. On OSX jag 10.2, no succes with ID 2.0, 2.0.1, 2.0.2, and I have try under classic on ID 2.0.2... No more succes... I use french version of OS and ID, and on OSX, I have a Applescript.framework 1.2.1.
Can somebody Help??? Here is my script :
--Create an example XML file
set myString to "<?xml version = \"1.0\"?>"
set myString to myString & "<story>"
set myString to myString & "<headline>Headline" & "</headline>" & return
set myString to myString & "<byline>by Author Name" & "</byline>" & return
set myString to myString & "<paragraph>This is the first line of an article." & �
"</paragraph></story>" & return & ""
set myFileName to choose file name with prompt "Save XML file as:"
open for access myFileName with write permission
set eof of myFileName to 0
write (myString as international text) to myFileName starting at eof
close access myFileName
tell application "InDesign 2.0.2"
set myDocument to make document
tell myDocument
--Create XML tags
set myXMLStoryTag to make XML Tag with properties {name:"story"}
set myXMLHeadlineTag to make XML Tag with properties {name:"headline"}
set myXMLBylineTag to make XML Tag with properties {name:"byline"}
set myXMLArticleTag to make XML Tag with properties {name:"paragraph"}
--Create or get a paragraph style
try
set myParagraphStyle to paragraph style "headline"
on error
set myParagraphStyle to make paragraph style �
with properties {style name:"headline", point size:24}
end try
--Map the paragraph style to an XML tag using an XML import map.
set myXMLImportMap to make XML import map �
with properties {mapped paragraph style:myParagraphStyle, markup tag:XML Tag "headline"}
try
set myParagraphStyle to paragraph style "byline"
on error
set myParagraphStyle to make paragraph style �
with properties {style name:"byline", point size:12}
end try
set myXMLImportMap to make XML import map �
with properties {mapped paragraph style:myParagraphStyle, markup tag:XML Tag "byline"}
try
set myParagraphStyle to paragraph style "paragraph"
on error
set myParagraphStyle to make paragraph style �
with properties {style name:"paragraph", point size:10}
end try
set myXMLImportMap to make XML import map �
with properties {mapped paragraph style:myParagraphStyle, markup tag:XML Tag "paragraph"}
tell page 1
set myTextFrame to make text frame �
with properties {geometric bounds:{"3p", "3p", "18p", "24p"}}
end tell
import XML from myFileName
set associated object of XML Element "story" to myTextFrame
end tell
end tell
Thank you to all who read this... And try to help...
Technical Details
Message-ID:
<1de75879.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!newsfeed.cwix.com!newsfeed.nyc.globix.net!news-out.nuthinbutnews.com!propagator2-sterling!news-in-sterling.newsfeed.com!news-in.nuthinbutnews.com!npeer.de.kpn-eurorings.net!uni-erlangen.de!news.imp.ch!news.imp.ch!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,483ac3648a4330a3,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-12 14:37:50 PST From: "Bouchonneau Ludovic" <kurt@outremer.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!newsfeed.cwix.com!newsfeed.nyc.globix.net!news-out.nuthinbutnews.com!propagator2-sterling!news-in-sterling.newsfeed.com!news-in.nuthinbutnews.com!npeer.de.kpn-eurorings.net!uni-erlangen.de!news.imp.ch!news.imp.ch!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: import XML fonctionning ONLY on OS9???? Message-ID: <1de75879.-1@WebX.la2eafNXanI> Date: Sun, 12 Jan 2003 14:21:10 -0800 Lines: 73 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit