Automation AppleScript";Can’;“我没有收到每一张账单”;

Automation AppleScript";Can’;“我没有收到每一张账单”;,automation,applescript,ui-automation,Automation,Applescript,Ui Automation,今天我第一次试用AppleScript 想从记录my Notes.app中每个便笺的名称开始吗 这是我的剧本: tell application "Notes" activate set mainAccount to the name of account 1 tell account mainAccount repeat with n in notes log name of n as string end rep

今天我第一次试用AppleScript

想从记录my Notes.app中每个便笺的名称开始吗

这是我的剧本:

tell application "Notes"
    activate
    set mainAccount to the name of account 1
    tell account mainAccount
        repeat with n in notes
            log name of n as string
        end repeat
    end tell
end tell
我收到一条错误消息:

tell application "Notes"
    activate
    get name of account 1
        --> "iCloud"
    exists folder "Archive" of account "iCloud"
        --> true
    count every note of account "iCloud"
        --> error number -1728 from every note of account "iCloud"
Result:
error "Notes got an error: Can’t get every note of account \"iCloud\"." number -1728 from every note of account "iCloud"

这里发生了什么?

帐户没有笔记,只有文件夹

因此,脚本可以这样编写:

tell application "Notes"
    activate
    set mainAccount to the name of account 1
    tell account mainAccount
        repeat with f in folders
            repeat with n in notes of f
                log name of n as string
            end repeat
        end repeat
    end tell
end tell