aaa

Apple Script API

SideNotes provides Apple Script API. It allows to manipulate notes and folders. To see the full reference you should press O in Script Editor app and choose SideNotes from the list.

Apple Script

A good example of SideNotes' Apple Script usage is our Alfred Workflow. You can download it and take a look at scripts. Please note that they have been written in JavaScript.

Folders

Getting all folders

tell application "SideNotes"
    get every folder
end tell

Get all folder names

tell application "SideNotes"
    get name of every folder
end tell

Adding a new folder

tell application "SideNotes"
    make new folder with properties { name: "New folder" }
end tell

Modifying folder name

tell application "SideNotes"
    set f to make new folder with properties { name: "New folder" }
    set name of f to "Better name"
end tell

Deleting existing folder

In this example, a new folder is created and immediately deleted.

tell application "SideNotes"
    make new folder with properties {name:"New folder to delete"}

    set f to get first folder where name is "New folder to delete"
    delete f
end tell

Notes

Getting all notes in a folder

tell application "SideNotes"
    set f to first folder
    get notes in f
end tell

Adding a new note

tell application "SideNotes"
    set f to first folder
    make new note in f with properties { text: "Hello World" }
end tell

Modifying a note

tell application "SideNotes"
    set n to first note of first folder 
    set text of n to "Note text"
end tell

Deleting existing note

In this example, a new note is created and then deleted

tell application "SideNotes"
    set f to first folder
    set n to make new note in f with properties { text: "Hello World" }
    delete n
end tell

Commands

Opening folder

tell application "SideNotes"
    set f to first folder where name is "New Folder"
    open folder f
end tell

Show all folders

tell application "SideNotes"
    show all folders
end tell

Search

The result of this command is returned in a dictionary-format. It consists of 4 keys:

  • identifier - an unique identifier of a note or a folder
  • type - folder or note
  • title - title of the search result
  • details - additional text to be displayed in the search result
tell application "SideNotes"
    search "hello"
end tell

Search Notes

The result of this command is an array of Note type.

tell application "SideNotes"
    search notes "hello"
end tell

Search Folders

The result of this command is an array of Folder type.

tell application "SideNotes"
    search folders "hello"
end tell

Search Themes

The result of this command is a dictionary which consists of the following keys:

  • name - theme name
  • path - path of the theme file
tell application "SideNotes"
    search themes "Default"
end tell

Set Theme

To set a theme you need to know its path and the theme must have been already installed. The theme path you may get by using search themes command

tell application "SideNotes"
    set theme "the-path"
end tell

Show Preferences

This command just shows the Preferences window.

tell application "SideNotes"
    show preferences
end tell