I’m trying to use the ‘PDF WorkFlow’ feature but when I try th scripts given by Apple it crashes the application that is trying to use the script. Any idea ?
on open these_items
try
set this_file to item 1 of these_items
tell application "Finder"
set the file_name to the name of this_file
set the parent_folder to (the container of this_file) as alias
end tell
tell application (path to frontmost application as string)
repeat
display dialog "Enter a name for file:" default answer file_name
set this_name to the text returned of the result
if this_name is not "" then exit repeat
end repeat
end tell
tell application "Finder"
set the name of this_file to this_name
set the target_file to ¬
(document file this_name of the parent_folder) as alias
end tell
tell application "Mail"
set the new_message to ¬
(make new outgoing message with properties ¬
{visible:true, content:" "})
tell the new_message
tell content
make new attachment with properties ¬
{file name:target_file} at ¬
before the first character
end tell
end tell
end tell
on error error_message number error_number
if the error_number is not -128 then
tell application (path to frontmost application as string)
display dialog error_message buttons {"OK"} default button 1
end tell
else
tell application "Finder" to delete parent_folder
end if
end try
end open