以下是一个使用AppleScript的示例代码,可以从指定文件夹中复制两个图片,并将它们粘贴到Outlook邮件的正文中:
tell application "Finder"
set imageFolderPath to choose folder with prompt "选择图片文件夹"
set imageFiles to (files of entire contents of imageFolderPath) as alias list
end tell
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {subject:"邮件主题", content:"邮件正文"}
tell newMessage
repeat with imageFile in imageFiles
set imageAttachment to make new attachment with properties {file: imageFile}
make new content attachment with properties {attachment: imageAttachment}
end repeat
end tell
activate
end tell
请注意,在运行此脚本之前,请确保你已经打开了Outlook应用程序。
你需要将"邮件主题"
和"邮件正文"
替换为你想要的邮件主题和正文内容。
代码中的choose folder with prompt
命令将弹出一个对话框,让用户选择所需的图像文件夹。如果你希望直接指定文件夹路径,可以将imageFolderPath
变量替换为文件夹路径的字符串。
此代码将遍历所选文件夹中的所有文件,并将每个文件作为附件添加到Outlook邮件的正文中。
希望这可以帮助到你!