1

我是 applescript 的新手,在做一些看似非常基本的事情时遇到了巨大的麻烦。我正在尝试以带有附件的 RTF 格式保存选定的邮件。这是错误的脚本:

    tell application "Mail"
        activate
        set AllMessages to selection
        set myMessage to item 1 of AllMessages
        open myMessage
        tell application "System Events"
            tell process "Mail"
                tell menu bar 1
                    tell menu bar item "File"
                        tell menu "File"
                            click menu item "Save As…"
                            delay 2
                            keystroke "test"
                            click checkbox "Include Attachments" -- result: ERROR
                        end tell
                    end tell
                end tell
            end tell
        end tell
    end tell
4

1 回答 1

0

你可以尝试这样的事情:

set the clipboard to POSIX path of (path to desktop as text) & "test"

tell application "Mail"
    open first item of (get selection)
    activate
end tell

tell application "System Events"
    tell process "Mail"
        click menu item "Save As…" of menu 1 of menu bar item "File" of menu bar 1
        delay 3
        perform action "AXPress" of pop up button 1 of group 1 of sheet 1 of window 1
        click menu item 1 of menu 1 of pop up button 1 of group 1 of sheet 1 of window 1
        if value of checkbox "Include Attachments" of group 1 of sheet 1 of window 1 = 0 then
            perform action "AXPress" of checkbox "Include Attachments" of group 1 of sheet 1 of window 1
        end if
        keystroke "g" using {command down, shift down}
        keystroke "v" using {command down}
        keystroke return
        keystroke return

    end tell
end tell
于 2013-02-07T17:03:10.840 回答