Re: eps -> pdf
Re: eps -> pdf
- Subject: Re: eps -> pdf
- From: Richard Rönnbäck <email@hidden>
- Date: Tue, 20 Jan 2004 18:24:28 +0100
Ian,
As other said, the shell command "pstopdf" (without quotes) does what you
want, but it offers no output options on compression, color handling etc.
As it happens I wrote a script just yesterday that displays a choose file
dialog to pick the EPS or PS file you like to convert, displays a choose
folder dialog to determine destination and from there it's just a lot of
error handling etc.
The dialogs and the error messages are in Swedish but you vill get it anyway
I would think
tell application "Finder"
set AppleScript's text item delimiters to ""
set myOkToRun to true
set theSelectedFile to choose file "Vdlj den EPS- eller PS-fil du vill
konvertera till PDF." without invisibles
set theSelectedFileName to name of theSelectedFile
if name extension of theSelectedFile is "eps" or "EPS" then
set theBaseFileName to ((characters 1 thru -5) of
theSelectedFileName) as string
else if name extension of theSelectedFile is "ps" or "PS" then
set theBaseFileName to ((characters 1 thru -4) of
theSelectedFileName) as string
else
set myOkToRun to false
display dialog "Filen du valde verkar inte vara en postcriptfil.
Vdlj en fil med korrekt fildndelse." with icon stop
end if
if myOkToRun is true then
set the theErrMsg to ""
try
set theErrMsg to "Kunde inte sdtta POSIX-svkvdg fvr den valda
filen"
set theFilePosixPath to POSIX path of theSelectedFile
set theErrMsg to "Kunde inte ange citerad form fvr den valda
filens POSIX-svkvdg"
set theQuotedInputPosix to quoted form of theFilePosixPath
set theErrMsg to ""
set theOutputFile to choose file name "Ange ett namn fvr den nya
filen" default name (theBaseFileName & ".pdf")
set theErrMsg to "Kunde inte sdtta POSIX-svkvdg fvr det nya
filnamnet"
set theOutputPosix to POSIX path of theOutputFile
set theErrMsg to "Kunde inte ange citerad form fvr det nya
filnamnets POSIX-svkvdg"
set theQuotedOutputPosix to quoted form of theOutputPosix
set theErrMsg to "Kunde inte utfvra shellscript"
set theShellScript to do shell script "pstopdf " &
theQuotedInputPosix & " -o " & theQuotedOutputPosix
set theOutputFile to (theOutputFile as string)
set AppleScript's text item delimiters to ":"
set theErrMsg to "Kunde inte hdmta objekt -2 av theOutPutFile"
set theResultContainer to text item -2 of theOutputFile
set AppleScript's text item delimiters to ""
if the theResultContainer is "Desktop" then
display dialog "Filen \"" & (theBaseFileName & ".pdf") & "\"
har lags pe skrivbordet"
else
display dialog ("Filen \"" & (theBaseFileName & ".pdf") & "
har lags i mappen \"" & (theResultContainer as string) & "\"")
end if
on error
set AppleScript's text item delimiters to ""
if the theErrMsg is not "" then
display dialog theErrMsg with icon stop
else
display dialog "Du valde att avbryta scriptet. Ingen PDF-fil
har skapats" with icon 2
end if
end try
end if
end tell
_______________________________________________
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.
References: | |
| >eps -> pdf (From: Ian Ferguson <email@hidden>) |