Hello!
This script works correctly when I select files from the finder, but not from the Desktop, then I have gotten the files from the last move operation from the Desktop to a folder via Finder.
Can somebody enlighten me a little bit on that?
global selected_items
tell application "Finder"
activate
set the selected_items to (selection)
if the selected_items is {} then
beep
display dialog "Please choose some file to attach to a new mail message and run this script again!" buttons {"Cancel"} default button 1
error number -128
end if
end tell
tell application "Mail"
activate
try
set newMessage to make new outgoing message with properties {visible:true, subject:"My Subject", content:"My Body"}
tell newMessage
repeat with anAttachment in the selected_items
tell content to make new attachment with properties {file name:anAttachment as alias} at after the last paragraph
end repeat
end tell
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"Cancel"} default button 1
end try
end tell
Best Regards
McUsr