gpt4 book ai didi

macos - AppleScript:如何在 Apple Notes 中自动创建新笔记

转载 作者:行者123 更新时间:2023-12-05 01:01:28 25 4
gpt4 key购买 nike

我正在尝试在 Notes.app 中自动快速创建新笔记,我想在单个 float 窗口中打开我新创建的笔记。

这是我创建笔记的代码:

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

有什么想法吗?

最佳答案

Notes 本身并没有用于selection 的脚本命令,但是show 命令会在显示它。也没有使用 Notes float 窗口的命令,但可以使用 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

关于macos - AppleScript:如何在 Apple Notes 中自动创建新笔记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44166773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com