Hi
I am lost!
I am trying to use KM to allow me to attach selected files in Finder to an Outlook Mac (V16) message.
To attach one file I use the following Applescript which works in KM perfectly:
tell application "Finder" to set selectedItem to item 1 of (get selection)
set theAttachment to selectedItem as alias
set fileName to name of selectedItem
tell application "Microsoft Outlook"
activate
set newMessage to make new outgoing message with properties {subject:fileName}
tell newMessage
make new attachment with properties {file:theAttachment}
end tell
open newMessage
get newMessage
end tell
What I wanted to do is to use the same Applescript but to be able to pass more than one file to the Applescript and attach those to an email. I looked high and low but could not find a way.
I then found a way to use Automator. If I create an Automator Service and use the following, it works perfectly. In KM using the service or a Workflow using the same code, I get an error and it doesn't work.
on run {input, parameters}
set SelectedItems to input
tell application "Finder" to set fileName to name of first item of SelectedItems
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {subject:fileName}
tell newMessage
repeat with aFile in SelectedItems
make new attachment with properties {file:aFile}
end repeat
end tell
open newMessage
get newMessage
end tell
return input
end run
Can you help?
Thanks
Andrew