Is...a puzzlement!
Is...a puzzlement!
- Subject: Is...a puzzlement!
- From: "John C. Welch" <email@hidden>
- Date: Fri, 02 Aug 2002 12:31:34 -0400
Any ideas on why the run handler in the following script is blowing up on
the ps2PDF() function, but the open handler isn't?
TIA,
john
on run
tell application "Finder"
set PostscriptFiles to selection
if (count items in PostscriptFiles) = 0 then --no files selected
badSelection()
end if
ps2pdf(PostscriptFiles)
end tell
end run
on open PostscriptFiles --droplet handler
if (count items in PostscriptFiles) = 0 then --no files
badSelection() --bad selection handler
end if
ps2pdf(PostscriptFiles)
end open
on badSelection() --scolding for trying to convert zero files
display dialog "You must have select least ONE
valid postscript file for this script to work!"
quit
end badSelection
on ps2pdf(PostscriptFiles) --conversion handler
repeat with thePSFile in PostscriptFiles --make sure we have real
postscript files
set theFileInfo to info for thePSFile --get the finder information
for the file
set theExtension to name extension of theFileInfo
if theExtension is "ps" or theExtension is "eps" then --all
postscript files are text, this is the only way to tell
try
tell application "macps2pdf" --this app will auto convert
any valid postscript file to a PDF,
open thePSFile --so just make sure your settings are
good
end tell
end try
delay 10 --needed so macps2pdf can clean up after itself
else --invalid file extension
set theName to name of theFileInfo
display dialog theName & " is not a valid postscript file.
I really need a '.ps' or an '.eps' extension,
as all postscript files are just text files,
so the extension is the only thing I have to work with."
end if
end repeat
tell application "macps2pdf"
quit
end tell
end ps2pdf
--
"There is no 'I' in TEAM."
US Navy SEALs
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.