在 AppleScript 中通过 iMessage 发送随机图像
Send random image via iMessage in AppleScript
我正在尝试通过 iMessage 从桌面上的 "lv" 文件夹发送随机图像。
tell application "Finder"
set theFile to some file of folder "Macintosh HD:Users:user:Desktop:lv:"
end tell
set randomImage to POSIX file theFile
tell application "Messages"
set targetBuddy to "appleid@mac.com"
set targetService to id of 1st service whose service type = iMessage
set textMessage to randomImage
set theBuddy to buddy targetBuddy of service id targetService
send textMessage to theBuddy
end tell
正在使用
tell application "Preview"
open theFile
end tell
我可以看出随机图像有效。但它没有传递给 iMessage。错误消息说 "expected type can't be converted"。错误代码 -1700
感谢任何建议!
更改以下行:
set randomImage to POSIX file theFile
对此:
set randomImage to (theFile as alias)
其余的应该没问题。
我正在尝试通过 iMessage 从桌面上的 "lv" 文件夹发送随机图像。
tell application "Finder"
set theFile to some file of folder "Macintosh HD:Users:user:Desktop:lv:"
end tell
set randomImage to POSIX file theFile
tell application "Messages"
set targetBuddy to "appleid@mac.com"
set targetService to id of 1st service whose service type = iMessage
set textMessage to randomImage
set theBuddy to buddy targetBuddy of service id targetService
send textMessage to theBuddy
end tell
正在使用
tell application "Preview"
open theFile
end tell
我可以看出随机图像有效。但它没有传递给 iMessage。错误消息说 "expected type can't be converted"。错误代码 -1700
感谢任何建议!
更改以下行:
set randomImage to POSIX file theFile
对此:
set randomImage to (theFile as alias)
其余的应该没问题。