Skip to content

Instantly share code, notes, and snippets.

@Cherrymelon
Forked from Luoyayu/bear_autosave.scpt
Created November 19, 2020 07:46
Show Gist options
  • Save Cherrymelon/08333f5ee991793b4e51dddde1633995 to your computer and use it in GitHub Desktop.
Save Cherrymelon/08333f5ee991793b4e51dddde1633995 to your computer and use it in GitHub Desktop.
Bear writer: autosave to icloud
tell application "System Events"
-- 前提/premiss:
-- 1. 在iCloud云盘下新建Bear文件夹/Create a new folder "Bear" under the iCloud
-- 脚本做的事:/What the script does:
-- 1. 自动化点击/Automated click
tell application "Bear" to activate -- 打开Bear/Open Bear APP
tell process "Bear"
set frontmost to true -- 置于前台/At the front desk
click menu item "备份笔记..." of menu "文件" of menu bar item "文件" of menu bar 1 -- 点击文件->备份笔记
delay 1
key code 5 using {shift down, command down} -- ⌘+Shift+G
set the clipboard to "~/Library/Mobile Documents/com~apple~CloudDocs/Bear"
key code 9 using {command down}
delay 1
key code 76
click button "导出笔记" of window "请选择保存笔记的位置" of application process "Bear" of application "System Events"
-- key code 13 using {command down} -- ⌘+W -- close Bear Windows
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment