【发布时间】:2020-01-18 21:46:35
【问题描述】:
在“笔记”中,可以通过双击笔记列表中的某个笔记在新窗口中打开某个笔记(左侧的笔记概览不可见)。
一定有办法通过 applescript 做到这一点...即使经过相当长时间的研究,我也找不到任何与该问题相关的内容。
有人知道怎么做吗?
【问题讨论】:
标签: applescript
在“笔记”中,可以通过双击笔记列表中的某个笔记在新窗口中打开某个笔记(左侧的笔记概览不可见)。
一定有办法通过 applescript 做到这一点...即使经过相当长时间的研究,我也找不到任何与该问题相关的内容。
有人知道怎么做吗?
【问题讨论】:
标签: applescript
使用普通的 AppleScript 除了使用 UI 脚本 之外,没有其他编程方式。请注意,这也需要给予例如脚本编辑器,或运行 AppleScript 代码的任何应用程序,accessibility privileges 以使其正常工作。
您需要通过name 或id 将Notes 告诉show note,然后使用系统事件 单击 em> Notes 的 Window menu 上的 Float Selected Note 菜单项。
tell application "Notes"
show note "Foobar"
activate
end tell
delay 0.5
tell application "System Events" to ¬
tell application process "Notes" to ¬
click menu item "Float Selected Note" of ¬
menu 1 of ¬
menu bar item "Window" of ¬
menu bar 1
注意:将Foobar改成name你想在单独的窗口中打开的name或者使用它的id,例如:
note id "x-coredata://C48EA527-911C-49D0-950F-A15229B7D58F/ICNote/p55"
您还可以通过 number 将 Notes 告诉 show 和 note,还可以包括 account 的 name 以及 @987654340 @ of a folder(如果适用),例如:
tell application "Notes"
tell account "Name"
tell folder "Name"
show note 1
end tell
end tell
end tell
注意:将Name 替换为对象 的实际名称。根据需要更改note 的编号。
然后使用如上所示的系统事件 命令点击目标菜单项。
注意:示例 AppleScript 代码就是这样,不包含任何错误处理可能是适当的。用户有责任根据需要或需要添加任何错误处理。查看AppleScript Language Guide 中的try statement 和error statement。另请参阅Working with Errors。
【讨论】: