Notes 是一个很好用的富文本编辑器, 但是缺少 markdown 的一些实用的特性, 例如 code block 和 math mode. 为了在 notes 中模仿 (inline) code block 功能, 我们可以用紫色字体来写代码. 这个 AppleScript 提供了切换字体颜色的功能, 需要配合 Alfred 在 notes 激活的情况下使用(例如绑定快捷键 cmd+shift+c).
预设: 打开 Notes-Format-Font-Show Colors, 切换到 Color Palettes, 设置底部的第一个和第二个快捷颜色(例如黑色和紫色). 下方的 AppleScript 将修改字体颜色 (例如将黑色变为紫色, 或者反过来).
tell application "System Events"
repeat while not (exists window "Colors" of application process "Notes")
try
click menu item "Show Colors" of menu 1 of menu item "Font" of menu 1 of menu bar item "Format" of menu bar 1 of application process "Notes"
end try
end repeat
click UI element 3 of toolbar 1 of window "Colors" of application process "Notes"
set currentColor to value of color well 1 of splitter group 1 of window "Colors" of application process "Notes"
set color1 to value of color well 1 of list 1 of list "favorite swatches" of scroll area 2 of splitter group 1 of window "Colors" of application process "Notes"
set color2 to value of color well 2 of list 1 of list "favorite swatches" of scroll area 2 of splitter group 1 of window "Colors" of application process "Notes"
if (currentColor = color1) then
click color well 2 of list 1 of list "favorite swatches" of scroll area 2 of splitter group 1 of window "Colors" of application process "Notes"
else
click color well 1 of list 1 of list "favorite swatches" of scroll area 2 of splitter group 1 of window "Colors" of application process "Notes"
end if
repeat while (exists window "Colors" of application process "Notes")
try
click menu item "Hide Colors" of menu 1 of menu item "Font" of menu 1 of menu bar item "Format" of menu bar 1 of application process "Notes"
end try
end repeat
end tell
1
keleo030 2022-01-31 12:18:16 +08:00 via iPad
感谢分享,听上去有点麻烦。用 notes 的人估计也不多,不过我是 notes 的忠实铁粉,配合 applepencil 体验真不错。
|