我正在尝试自动快速创建新笔记,并且Notes.app我想在单个浮动窗口中打开新创建的笔记。
这是我创建注释的代码:
set RunTime to ((current date)) as string
tell application "Notes"
activate
tell account "iCloud"
make new note at folder "Notes" with properties {name:RunTime}
--does not work
--open document {name:RunTime}
end tell
end tell
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?
Notes本身没有脚本命令selection,但该show命令会在显示过程中选择指定的注释。也没有使用 Notes 浮动窗口的命令,但可以使用 GUI 脚本来选择该菜单项,例如 (Mojave):
set example to (current date) as string
tell application "Notes"
activate
tell folder "Notes" -- or whatever
set theNote to make new note with properties {name:example} -- 'make' returns a reference to the new note
end tell
try
(* If not making a new note, existing notes can be referenced by using id or name properties:
set theNote to note id "xyz" -- id property
-- or --
set theNote to note example -- name property
-- or --
tell (get every note whose name is example) -- filter form
if it is {} then error "A note named \"" & example & "\" was not found."
set theNote to its first item
end tell
*)
show theNote -- also selects the note
delay 0.25
tell application "System Events" to click menu item "Float Selected Note" of menu "Window" of menu bar item "Window" of menu bar 1 of application process "Notes"
on error errmess -- not able to get the note
log errmess
display alert "Error getting note" message errmess
end try
end tell
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4221 次 |
| 最近记录: |