【问题标题】:Send random image via iMessage in AppleScript在 AppleScript 中通过 iMessage 发送随机图像
【发布时间】:2018-06-28 02:21:58
【问题描述】:

我正在尝试通过 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。错误消息说“无法转换预期的类型”。错误代码-1700

感谢您的任何建议!

【问题讨论】:

    标签: image random applescript imessage


    【解决方案1】:

    更改以下行:

        set randomImage to POSIX file theFile
    

    到这里:

        set randomImage to (theFile as alias)
    

    其余的应该没问题。

    【讨论】:

      猜你喜欢
      • 2019-03-31
      • 1970-01-01
      • 2013-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多