Article View: adobe.scripting.indesign
Article #15482AS- Script crashes InDesign 2.0.2
From: DOR_Web
Date: Thu, 04 Dec 2003 18:43
Date: Thu, 04 Dec 2003 18:43
74 lines
3177 bytes
3177 bytes
Hardware/Software: Power Mac G3, OS X 10.1, InDesign 2.0.2, Word 98
We have a annual printed publication that is being pieced into a Filemaker Pro database for publication on the Web. Our publication has several tables used for formatting formulas and other data.
We're using a modified version of the "XML-to-Database" AppleScript included with the InDesign 2.0 CD to move the contents of the pub to Filemaker Pro. To make the automation easier, I'd like to include the HTML in the document instead of pasting it into Filemaker Pro later.
I'm using the following script to convert InDesign tables into HTML. However, after the script finishes, as soon as I click into the newly-pasted HTML, InDesign crashes.
I'm having a similar problem with a find/replace script on the same HTML used to strip out the unnecessary coding.
Here is the script for converting and pasting the HTML.
--Open InDesign, Word, then bring InDesign to the front
tell application "Finder"
activate application "InDesign 2.0.2"
activate application "Microsoft Word"
activate application "InDesign 2.0.2"
end tell
--Copy the selected text in InDesign. If an error occurs, alert the user.
tell application "InDesign 2.0.2"
set mySelection to selection
try
copy
on error
beep
display dialog "Select a table to copy, then run the script again."
end try
end tell
--Bring Microsoft Word to the front
tell application "Finder"
activate application "Microsoft Word"
end tell
--Create a new document in Word, paste the clipboard contents, then perform Table Macro,�
--which will save the document as HTML, strip all styles, and save again.
tell application "Microsoft Word"
make new document
paste
do Visual Basic "Table"
end tell
--Switch back to InDesign
tell application "Finder"
activate application "InDesign 2.0.2"
end tell
--Place table.html document into a new text frame, copy the HTML code, and paste over original table.
tell application "InDesign 2.0.2"
set theHD to "Macintosh HD:"
set thePath to theHD & "Users:username:Desktop:"
set theFile to "table.html"
set theSource to thePath & theFile as alias
tell application "InDesign 2.0.2"
activate
set theDoc to active document
tell theDoc
set mySelection to selection
set myFrame to make text frame with properties �
{geometric bounds:{"3p0", "3p0", "5p0", "5p0"}}
tell myFrame
place theSource
select text 1 of parent story of myFrame
cut
end tell
delete myFrame
select mySelection
paste
end tell
end tell
end tell
Technical Details
Message-ID:
<2ccebe63.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,c23abe018c2c9b8a,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-12-04 11:08:06 PST From: DOR_Web@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: AS- Script crashes InDesign 2.0.2 Message-ID: <2ccebe63.-1@webx.la2eafNXanI> Date: Thu, 4 Dec 2003 10:43:16 -0800 Lines: 86 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit