Soy un novato con applecript. Logré reunir un pequeño script que agregue los archivos seleccionados desde el buscador a un archivo adjunto de correo electrónico como un flujo de trabajo de servicio. Ahora me pegué en el último número. Me gustaría añadir el nombre del archivo al tema. Aquí está la manzana. ¿Alguien podría ayudar?
property mailSubjectPrefix : "Datei(en) für dich: "
property subjAttNameSeparator : ", "
property attachSeparator : "*******"
property attachPrefix : "Anhänge:"
set theSubject to "Datei(en): "
set theContent to "Datei(en) für dich:"
set recipientAddress to {}
tell application "Contacts"
set recipientAddress to "[email protected]"
end tell
tell application "Finder"
-- Make a list to gather the names of the selected files
set fileAliases to {}
-- Get the selection of the frontmost Finder window
set fileSelection to the selection
-- Iterate of the selection
repeat with fileItem in fileSelection
copy the fileItem as alias to the end of fileAliases
end repeat
-- Check if the selection is not empty
if the number of items of fileAliases is 0 then
-- Audible feedback, so the script always does something.
beep
else
-- Now talk to mail to create the message
tell application "Mail"
set newMessage to make new outgoing message at beginning with properties { content:theContent, visible:true}
set mailSubject to {}
-- Set a recipient
tell newMessage
make new to recipient at end with properties {address:recipientAddress}
set MailSubject to fileAliases
set oTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to subjAttNameSeparator
set subject to mailSubjectPrefix & (mailSubject as string)
set AppleScript's text item delimiters to oTID
end tell
-- Attach all the selected files
repeat with fileAlias in fileAliases
make new attachment with properties {file name:fileAlias} at after the last paragraph of newMessage
end repeat
-- Put Mail in the foreground
activate
end tell
end if
end tell