- Registriert
- 17.05.15
- Beiträge
- 159
Hallo Leute,
ich habe folgendes Szenario: Ich erstelle einen Haufen einzelne Worddateien und will diese am Ende in PDFs umwandeln. Ich habe mir angewöhnt, dies mit einem Script zu machen, welches ich mal im Netz gefunden habe. Ich jage also alle Word Dateien durch den Automator, welcher mit dann am Ende PDFs speichert.
Dieses Script funktioniert nun aber komischerweise nicht mehr und ich weiß nicht woran es liegt. Hat einer von euch eine Ahnung?
on run {input, parameters}
try
repeat with thisFile in input
set thisPOSIXPath to POSIX path of thisFile as string
if thisPOSIXPath contains ".docx" or thisPOSIXPath contains ".doc" then
tell application "Microsoft Word"
set thisDoc to open file name (thisFile as string)
set thisName to my removeExtension(name of thisDoc)
set thisPath to path of thisDoc
set thisPath to POSIX path of thisPath
save as thisDoc file name thisPath & "/" & thisName & ".pdf" file format format PDF
close thisDoc saving no
end tell
end if
end repeat
on error error_message
display alert "WordToPDF" message error_message as warning
end try
return input
end run
on removeExtension(thisItem)
if thisItem does not contain "." then
return thisItem
end if
set text item delimiters to "."
set thisItem to (text items 1 thru -2 of thisItem) as string
set text item delimiters to ""
return thisItem
end removeExtension
Es kommt immer die Fehlermelden: Word würde das Kommando save as nicht verstehen. Weiß jemand Rat?
Liebe Grüße Jan
ich habe folgendes Szenario: Ich erstelle einen Haufen einzelne Worddateien und will diese am Ende in PDFs umwandeln. Ich habe mir angewöhnt, dies mit einem Script zu machen, welches ich mal im Netz gefunden habe. Ich jage also alle Word Dateien durch den Automator, welcher mit dann am Ende PDFs speichert.
Dieses Script funktioniert nun aber komischerweise nicht mehr und ich weiß nicht woran es liegt. Hat einer von euch eine Ahnung?
on run {input, parameters}
try
repeat with thisFile in input
set thisPOSIXPath to POSIX path of thisFile as string
if thisPOSIXPath contains ".docx" or thisPOSIXPath contains ".doc" then
tell application "Microsoft Word"
set thisDoc to open file name (thisFile as string)
set thisName to my removeExtension(name of thisDoc)
set thisPath to path of thisDoc
set thisPath to POSIX path of thisPath
save as thisDoc file name thisPath & "/" & thisName & ".pdf" file format format PDF
close thisDoc saving no
end tell
end if
end repeat
on error error_message
display alert "WordToPDF" message error_message as warning
end try
return input
end run
on removeExtension(thisItem)
if thisItem does not contain "." then
return thisItem
end if
set text item delimiters to "."
set thisItem to (text items 1 thru -2 of thisItem) as string
set text item delimiters to ""
return thisItem
end removeExtension
Es kommt immer die Fehlermelden: Word würde das Kommando save as nicht verstehen. Weiß jemand Rat?
Liebe Grüße Jan