当前位置: 首页 > news >正文

Mac - 印象笔记开发者

 
在Mac上使用印象笔记,可以利用Applescript来编写脚本,自动化快速地创建笔记本和笔记,并且可以通过代码逻辑实现批量创建操作,比如通常遇到的文件夹下多个文件需要创建导入到印象笔记的对应笔记本中。
 
下面贴出了印象笔记开发网站上给出的参考AppleScript代码样例。
 
-- This script includes examples for using AppleScript to perform several
 
-- useful tasks with Evernote.
 
-- Each section illustrates a chunk of Evernote's AppleScript interface,
 
-- and each section also cleans up after itself.
 
-- Please refer to the Evernote application's scripting dictionary for
 
-- detailed information and BE CAREFUL: operations that would normally
 
-- confirmation from the user (such as deleting notes, etc) are
 
-- completed without warning when invoked from AppleScript!
 
tell application "Evernote"
-- create, rename, and delete notebooks
if (not (notebook named "AppleScriptNotebook1" exists)) then
-- NOTE also check out the "create notebook" command
make notebook with properties {name:"AppleScriptNotebook1"}
end if
set name of notebook "AppleScriptNotebook1" to "AppleScriptNotebook2"
-- WARNING there is no confirmation!
delete notebook "AppleScriptNotebook2"
------------------------------------
-- create, rename, and delete tags
if (not (tag named "AppleScriptTag1" exists)) then
make tag with properties {name:"AppleScriptTag1"}
-- create a sub-tag
make tag with properties {name:"AppleScriptTag2", parent:tag named "AppleScriptTag1"}
end if
set name of tag "AppleScriptTag1" to "AppleScriptTag3"
-- WARNING there is no confirmation, and all subtags are deleted as well!
delete tag "AppleScriptTag3"
------------------------------------
-- create notes, four ways
-- 1: with plain text
set notebook1 to create notebook "AppleScriptNotebook1"
create note title "Note 1" with text "Here is my new text note" notebook notebook1
-- 2: with html
create note title "Note 2" with html "<strong>Here is my new HTML note</strong>" notebook notebook1
-- 3: with the data from a URL
create note title "Note 3" from url "http://www.evernote.com/media/images/logo.png" notebook notebook1
-- 4: with the data from a file
create note title "Note 4" from file "/path/to/a/file.txt" notebook notebook1
-- cleanup
delete notebook1
------------------------------------
-- move note between notebooks
create notebook "AppleScriptNotebook1"
create notebook "AppleScriptNotebook2"
create note title "Note 1" with text "Moving note" notebook "AppleScriptNotebook1"
move note 1 of notebook "AppleScriptNotebook1" to notebook "AppleScriptNotebook2"
-- cleanup
delete notebook "AppleScriptNotebook1"
delete notebook "AppleScriptNotebook2"
------------------------------------
-- delete individual notes
create notebook "AppleScriptNotebook1"
create note title "Note 1" with text "Delete this note!" notebook "AppleScriptNotebook1"
delete note 1 of notebook "AppleScriptNotebook1"
-- cleanup
delete notebook "AppleScriptNotebook1"
------------------------------------
-- assign, unnasign tags
create notebook "AppleScriptNotebook1"
set note1 to create note title "Note 1" with text "Note 1" notebook "AppleScriptNotebook1"
set note2 to create note title "Note 2" with text "Note 2" notebook "AppleScriptNotebook1"
set note3 to create note title "Note 3" with text "Note 3" notebook "AppleScriptNotebook1"
set tag1 to make tag with properties {name:"AppleScriptTag1"}
set tag2 to make tag with properties {name:"AppleScriptTag2", parent:tag named "AppleScriptTag1"}
set tag3 to make tag with properties {name:"AppleScriptTag3", parent:tag named "AppleScriptTag1"}
assign tag1 to note1
assign {tag2, tag3} to {note2, note3}
unassign tag1 from note1
unassign {tag2, tag3} from {note2, note3}
-- cleanup
delete notebook "AppleScriptNotebook1"
delete tag "AppleScriptTag1"
------------------------------------
-- open a note in its own window
set notebook1 to create notebook "AppleScriptNotebook1"
set note1 to create note with text "Note 1" notebook notebook1
open note window with note1
-- cleanup
delay (3) -- wait to be sure new window has opened
close window 1
delete notebook1
------------------------------------
-- change the query used in a note collection window
-- (assumes the default note collection window is open and is window 1)
set notebook1 to create notebook "AppleScriptNotebook1"
set note1 to create note with text "ONLY ME!" notebook notebook1
set query string of window 1 to "notebook:AppleScriptNotebook1"
-- cleanup
delete notebook1
------------------------------------
-- open a new collection window with a specific query
set notebook1 to create notebook "AppleScriptNotebook1"
set note1 to create note with text "ONLY ME!" notebook notebook1
open collection window with query string "notebook:AppleScriptNotebook1"
-- cleanup
delay (3) -- wait to be sure new window has opened
close window 1
delete notebook1
------------------------------------
-- append data to a note
set notebook1 to create notebook "AppleScriptNotebook1"
set note1 to create note with text "foo" notebook notebook1
tell note1 to append html "<strong>bar</strong>"
tell note1 to append text "baz"
-- cleanup
delete notebook1
------------------------------------
-- execute a query and manipulate every note in the result
-- for details on the query syntax, see our Search Grammar overview
-- at http://dev.evernote.com/documentation/cloud/chapters/search_grammar.php
set notebook1 to create notebook "AppleScriptNotebook1"
set note1 to create note with text "An apple is a fruit" notebook notebook1
set note2 to create note with text "An Apple is a computer" notebook notebook1
set note3 to create note with text "An orange is a fruit" notebook notebook1
set note4 to create note with text "An Amiga is a computer" notebook notebook1
set tag1 to make tag with properties {name:"AppleScriptTag1"}
set matches to find notes "notebook:AppleScriptNotebook1 apple"
assign tag1 to matches
-- cleanup
delete tag1
delete notebook1
------------------------------------
-- do something with the application's selected notes
set notebook1 to create notebook "AppleScriptNotebook1"
set note1 to create note with text "Note 1" notebook notebook1
set note2 to create note with text "Note 2" notebook notebook1
open collection window with query string "notebook:AppleScriptNotebook1"
set tag1 to make tag with properties {name:"AppleScriptTag1"}
delay (3) -- be sure the new window has opened
-- normally, a script would be activated to take action when the user had
-- made a selection, rather than this artificial demonstration
set noteList to selection
assign tag1 to noteList
-- note: the application's 'selection' property returns the same result as
-- the selection of window 1, if any
-- cleanup
close window 1
delete tag1
delete notebook1
------------------------------------
-- please refer to the Evernote application's scripting dictionary
-- for complete details on the Evernote AppleScript interface
end tell

转载于:https://www.cnblogs.com/kwang-cai/p/5703139.html

相关文章:

  • 关于bootstrap列偏移的两种方式
  • Tortoise SVN安装后右键没有菜单的解决方法
  • 软件测试忠告
  • 桌面远程链接
  • django中@property装饰器的运用
  • Neutron 不健全的HA ROUTER
  • nwjs
  • (Forward) Music Player: From UI Proposal to Code
  • 【leetcode】经典算法题-Counting Bits
  • SQL--常用命令
  • JDK1.7新特性(1):Switch和数字
  • ios开发图片轮播器以及定时器小问题
  • Ubuntu里面软件的安装与卸载
  • ubuntu 设置DNS
  • jquery ajax 传数据到后台乱码的处理方法
  • Docker下部署自己的LNMP工作环境
  • HTTP中GET与POST的区别 99%的错误认识
  • iOS帅气加载动画、通知视图、红包助手、引导页、导航栏、朋友圈、小游戏等效果源码...
  • JS学习笔记——闭包
  • k8s 面向应用开发者的基础命令
  • Laravel5.4 Queues队列学习
  • MYSQL 的 IF 函数
  • Node项目之评分系统(二)- 数据库设计
  • python学习笔记 - ThreadLocal
  • react 代码优化(一) ——事件处理
  • Spark VS Hadoop:两大大数据分析系统深度解读
  • 闭包--闭包之tab栏切换(四)
  • 微信公众号开发小记——5.python微信红包
  • 一些基于React、Vue、Node.js、MongoDB技术栈的实践项目
  • #NOIP 2014# day.1 T3 飞扬的小鸟 bird
  • #我与Java虚拟机的故事#连载09:面试大厂逃不过的JVM
  • $.proxy和$.extend
  • (39)STM32——FLASH闪存
  • (day 2)JavaScript学习笔记(基础之变量、常量和注释)
  • (M)unity2D敌人的创建、人物属性设置,遇敌掉血
  • (层次遍历)104. 二叉树的最大深度
  • (附源码)springboot高校宿舍交电费系统 毕业设计031552
  • (附源码)计算机毕业设计ssm基于B_S的汽车售后服务管理系统
  • (附源码)小程序儿童艺术培训机构教育管理小程序 毕业设计 201740
  • (黑马C++)L06 重载与继承
  • (牛客腾讯思维编程题)编码编码分组打印下标(java 版本+ C版本)
  • (十)c52学习之旅-定时器实验
  • (转) RFS+AutoItLibrary测试web对话框
  • (转载)虚函数剖析
  • ****** 二 ******、软设笔记【数据结构】-KMP算法、树、二叉树
  • .net 后台导出excel ,word
  • .net 无限分类
  • /dev/VolGroup00/LogVol00:unexpected inconsistency;run fsck manually
  • @RestController注解的使用
  • @TableId注解详细介绍 mybaits 实体类主键注解
  • []使用 Tortoise SVN 创建 Externals 外部引用目录
  • [2016.7.test1] T2 偷天换日 [codevs 1163 访问艺术馆(类似)]
  • [AIGC] MySQL存储引擎详解
  • [Angular] 笔记 18:Angular Router
  • [Erlang 0129] Erlang 杂记 VI 2014年10月28日