AppleScript "Can’t get every note of account"
AppleScript "Can’t get every note of account"
我今天第一次试用 AppleScript。
想从在我的 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
我今天第一次试用 AppleScript。
想从在我的 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