Re: Word 2008 script broken in Word 2011
Re: Word 2008 script broken in Word 2011
- Subject: Re: Word 2008 script broken in Word 2011
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 29 May 2013 13:01:56 -0700
- Thread-topic: Word 2008 script broken in Word 2011
Title: Re: Word 2008 script broken in Word 2011
I have Word 2008, not 2011. But I cannot find anywhere in the Word 2008 Dictionary a 'format flat template' enumeration for the 'file format' parameter of 'save as', nor anywhere else in the Dictionary. I cannot even get that line of the script to compile for Word 2008, let alone run. It errors on 'flat template'. If you're using a saved complied script, the underlying raw code for 'flat template' may be deprecated in Word 2008 and 2011 but still compile, and will simply not do what you want when it runs (as you're seeing). (It's even possible that, as a deprecated function from 2004, it perhaps still ran in 2008 but no longer in 2011 where they might have cleaned things up. This would be consistent with what you've said.) I bet if you add a space somewhere in your script and try to compile it again, it won't compile.
However I do see a 'format PDF' enumeration for the 'file format' parameter of 'save as' in Word 2008, and I would expect it to be there as well in 2011. Have you tried that? Viz.
save as active document file name filname file format format PDF
(untested here)
--
Paul Berkowitz
From: Lists <email@hidden>
Date: Wed, 29 May 2013 12:07:21 -0700
To: AppleScript-Users <email@hidden>
Subject: Word 2008 script broken in Word 2011
Shortly after Office 2008 came out I wrote several export to PDF scripts. After trying them in Office 2011, they work except for the Word export to PDF script.
The Word script creates a corrupt PDF that Preview can't open. I'm wondering if anyone has encountered this, and how did you fix it?
Here is the script I'm using:
on open fillist
set bs to "/"
set d to "-"
tell application "Finder"
set defLoc to container of (item 1 of fillist) as alias
end tell
set destn to choose folder with prompt "You are converting Word files by copying them to PDF files." & return & "Select a location to save converted files." default location defLoc
repeat with lvar in fillist
tell application "Finder"
set thename to name of lvar
set filex to name extension of lvar
set l to length of filex
end tell
set nuname to text 1 thru text item -(l + 1) of thename
if "/" is in nuname then
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to bs
set txtLst to every text item of nuname as list
set AppleScript's text item delimiters to d
set nuname to txtLst as string
set AppleScript's text item delimiters to oldDelims
end if
set filname to (destn as string) & nuname & "pdf"
tell application "Microsoft Word"
launch
open lvar
save as active document file name filname file format format flat template
close window 1 saving no
end tell
end repeat
end open
Thanks
J
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden