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

时间: 2024-10-12 21:04:41

Mac - 印象笔记开发者的相关文章

Windows,Mac与Linux哪个更适合开发者?

以前写的,怕引来口水战,干脆不发.这段时间面试了十来人,用Mac的开发水平明显高于Windows的,挺多感想的,于是改改发了吧. Windows: 对普通用户而言体验最友好,对开发者体验最差: Linux:开发者的天堂,普通用户的噩梦:从嵌入式开发到应用开发,一应俱全: Mac:WEB开发与设计师首选,嵌入式开发不推荐:对普通用户而言Windows各有优劣: 为什么Linux是开发者天堂? 软件开发有很强的实践性,所以高质量的源码.技术文档对于开发者的成长是决定性的.假如一个人想了解操作系统原理

开发者账户迁移到多Mac设备

1.迁移设备主要做开发者证书.私钥.公钥的转移,可把正常使用的Mac上开发者证书导出,在keychain工具中选择两项一起导出保存为.p12格式,developer和distribution分别导出并保存 2.将上述导出的p12证书发送到新Mac机上双击安装 3.在xcode的Preferences页面上添加Apple Developer ID并从服务器上刷新相关profile下来

Mac下安装LNMP(Nginx+PHP5.6)环境(转)

安装Homebrew 最近工作环境切换到Mac,所以以OS X Yosemite(10.10.1)为例,记录一下从零开始安装Mac下LNMP环境的过程 确保系统已经安装xcode,然后使用一行命令安装依赖管理工具Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 之后就可以使用 brew install FORMULA 来安装所需要的依赖了.

iOS开发者必备的10款工具

当前iOS和Android两大移动操作系统"二足鼎立",几乎覆盖了市面上大部分的智能手机.相比Android,iOS开发适配更简单,且随着各种实用工具和Swift语言的出现,iOS开发门槛地降低,开发前景巨大.而对于开发者和设计师来说,是否拥有一款功能强大且实用的开发工具将直接影响其工作效率和成果.为此,我们结合现有资讯.整合最新资源,从开发.设计.分析.内测分发等方面整理出"iOS开发者必备的十款工具"供大家参考. 开发环境: 1)Xcode 作为苹果公司的当家I

Mac OS X 背后的故事

Mac OS X 背后的故事 作者: 王越  来源: <程序员>  发布时间: 2013-01-22 10:55  阅读: 25840 次  推荐: 49   原文链接   [收藏] 作者王越,美国宾夕法尼亚大学计算机系研究生,中国著名 TeX 开发者,非著名 OpenFOAM 开发者. Mac OS X 背后的故事(一)力挽狂澜的Ellen Hancock Mac OS X 背后的故事(二)Linus Torvalds的短视 Mac OS X 背后的故事(三)Mach之父Avie Tevan

Mac - NSView不能保证subview的z轴顺序

从iPhone转到mac的开发者,会自然而然的以为NSView的subview(或控件)是有z轴顺序的,但实际上apple并不保证subview是按照添加的顺序显示.NSView也不存在类似于UIView的bringSubviewToFront方法. 应该避免subview之间有交集.但由于我是把我的iPhone项目转成mac,我并不像改变太多.还是找到了解决方法.就是在addSubview的时候使用以下方法: [self addSubview:subviewFront positioned:N

前端调试效率低?试试这10个“Chrome开发者工具”使用技巧

天给大家分享一些使用“Chrome开发者工具”的小技巧.包括调试,优化页面渲染速度等.希望能提升Web开发人员的工作效率. 1,打开Shadow DOM显示 浏览器对例如Video.Password等组件进行了封装,无法查看到组件的详细代码,不利于调试.幸好,通过配置能够在元素标签器中显示被隐藏的组件代码. 实现:Settings → General → Elements → Show user agent shadow DOM 2,在控制台快速选择元素 在Chrome Dev Tools 控制

如何选择一款适合自己操作系统、Windows、Mac还是Linux?

如何选择一款适合自己操作系统.Windows.Mac还是Linux? 作者:我们都很努力着 简介:电脑已经逐渐离不开我们生活,但是如何选择一个我们最佳,最适合的电脑操作系统就成了一些困难选择人士的一个问题.不考虑硬件,只说系统,最少内存8G起步,CPU也得4核以上吧. 本文章适合程序员.小资人士或者喜欢折腾的人士.当然如果你想给自己打造一个独一无二的电脑操作系统的环境.那么你可以看看本篇文章. 一.Windows操作系统怎么样?选择那个合适! 个人计算机在中国的普及,大约是从1995年开始的,也

转载 理解objective c的Runtime

注:本文是对 Colin Wheeler 的 Understanding the Objective-C Runtime 的翻译. 初学 Objective-C(以下简称ObjC) 的人很容易忽略一个 ObjC 特性 —— ObjC Runtime.这是因为这门语言很容易上手,几个小时就能学会怎么使用,所以程序员们往往会把时间都花在了解 Cocoa 框架以及调整自己的程序的表现上.然而 Runtime 应该是每一个 ObjC 都应该要了解的东西,至少要理解编译器会把 [target doMeth