Octarine - Add to Note
Add selected text to your open Octarine note, or create a new note when no note is open in the active tab.
By Joe Cartwright
Requires the next ActionClip app update. Not available in the current public 2.3.2 release. Download the action file, open it in ActionClip, then review it before choosing Add Action. Get ActionClip if you haven’t installed it yet.
What it does
Keep useful text from articles, chats, and documents in Octarine without copying and switching apps manually. Open the note you want to use, select text in another app, and run Octarine - Add to Note. The text is added at the bottom of the active note, preserving its existing content. If the active tab has no note, a new Untitled note is created in the current workspace; rename it in Octarine afterward. Suggested for selections of ten or more words, and available to choose manually for shorter selections. Uses Octarine’s native editor and Paste command. Open one editable note pane and keep the current workspace ready before running. Tested with Octarine 0.53.1; later UI changes may require an action update.
How to use it
- Requires the next ActionClip app update. Not available in the current public 2.3.2 release.
- Choose Download action and open the downloaded .actionclip file.
- Review the action and choose Add Action.
- Select the text you want to use and choose Octarine - Add to Note.
Requirements
Octarine installed with a workspace open, a compatible ActionClip version with reviewed Community actions, and macOS Accessibility and Automation permissions for ActionClip to control Octarine through System Events. Use one editable note pane. Tested with Octarine 0.53.1.
Privacy
Sends the selected text locally to Octarine through macOS UI automation. Temporarily uses the clipboard and restores its readable contents afterward unless another app changes it during the operation. The action makes no network request. Octarine or a separately configured folder-sync service may synchronize the saved note.
Example
Input
Meeting follow-up
Share the revised plan with the team before Friday afternoon.Output
The selected text is added at the bottom of the active Octarine note. If no note is open in the active tab, it is added to a new Untitled note in the current workspace.View action source
use framework "AppKit"
use scripting additions
property ca : current application
on editor()
tell application "System Events" to tell process "Octarine"
set ws to windows whose subrole is "AXStandardWindow"
if ws is {} then return missing value
set r to group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of item 1 of ws
set es to {}
repeat with e in text areas of r
if (value of attribute "AXDOMClassList" of e) contains "ProseMirror" then set end of es to contents of e
end repeat
if (count es) > 1 then error "Use one note pane."
if es is {} then return missing value
return item 1 of es
end tell
end editor
on restore(p, b, c)
if p's changeCount() as integer is c then
p's clearContents()
p's writeObjects:b
end if
end restore
set t to "{{selected_text}}"
if ((ca's NSString's stringWithString:t)'s stringByTrimmingCharactersInSet:(ca's NSCharacterSet's whitespaceAndNewlineCharacterSet())) as text is "" then return "Nothing selected."
tell application "Octarine" to activate
set e to my editor()
if e is missing value then
tell application "System Events" to tell process "Octarine" to click menu item "New Note" of menu 1 of menu bar item "File" of menu bar 1
repeat 15 times
delay 0.1
set e to my editor()
if e is not missing value then exit repeat
end repeat
end if
if e is missing value then error "Open a workspace."
tell application "System Events"
if not settable of attribute "AXValue" of e then error "Note is read-only."
set v to value of e
set value of attribute "AXFocused" of e to true
end tell
set p to ca's NSPasteboard's generalPasteboard()
set b to ca's NSMutableArray's array()
repeat with i in p's pasteboardItems()
set j to ca's NSPasteboardItem's alloc()'s init()
repeat with k in i's types()
j's setData:(i's dataForType:k) forType:k
end repeat
b's addObject:j
end repeat
p's clearContents()
p's setString:t forType:"public.utf8-plain-text"
set c to p's changeCount() as integer
try
tell application "System Events" to tell process "Octarine"
set frontmost to true
key code 125 using command down
if v is not "" and v is not linefeed then key code {36, 36}
click menu item "Paste" of menu 1 of menu bar item "Edit" of menu bar 1
end tell
delay 0.3
my restore(p, b, c)
on error msg number num
my restore(p, b, c)
error msg number num
end try
tell application "System Events" to if value of e is v then error "Check the note before retry."
return "Added."