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
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.