Now that Pro, with Applescript available, will become the new Standard version for existing users, I wonder what you are using Applescript to achieve. In Omnifocus, I have a few simple but very convenient scripts, but I don’t really see what Applescript can do for me in Omnioutliner. I’m curious to hear about actual uses for it.
AppleScript can pull in information from other apps, for example pull the urls of all open Safari tabs and place them as links under a ‘References’ row.
I also find it useful to extend OO’s functionality a little: merge rows and their notes, collapse an outline to the level of the currently selected row, tell me where I am in an outline (a ‘breadcrumb’).
SG
SG, do you have a link to a script that does the Safari URL’s to OO links action? Thanks.
This one works well here…
SG
--gets current Safari urls and creates new links in OO under row named "References"
-- https://discourse-test.omnigroup.com/t/what-makes-the-text-in-a-topic-a-hyperlink/10179/14
-- any Safari pinned tabs included too, without links
-- see also https://discourse-test.omnigroup.com/t/can-a-service-capture-a-safari-url-to-an-existing-oo-outline/22499/3
tell application "Safari"
tell window 1 to set {topics, urls} to {tabs's name, tabs's URL}
end tell
tell application "OmniOutliner"
try
tell document 1
set refRow to row named "References"
-- delete refRow's children -- if want to start afresh not append
repeat with i from 1 to count topics
set newChild to make new row at refRow
tell newChild
set topic to topics's item i
set topic cell's text's style's attribute "link"'s value to urls's item i
end tell
end repeat
set refRow's expanded to true
end tell
end try
end tell
everything and anything.
Think of a thing you do in Omnifocus. then add “Automatically” to the beginning of the sentence.
“automatically create tasks to read every chapter in a book”
“Automatically create tasks from templates”
“automatically complete things that have time limits” etc.
I use it to convert my OO outlines into other formats – handouts, slides, lecture notes, fully typeset articles, reports, etc.
Previously I only used OO for outlines and checklists, since converting an OO outline into e.g. a typeset article was so time-consuming. But I’ve written some scripts that let me do most of my writing in OO, and then automatically convert what I’ve written to whatever format I need, formatted to my specifications. This is great, because OO is fantastic for writing/revising complex documents from start to finish (much better than e.g. Ulysses IMO), but not for formatting them for consumption by others.
The centre of gravity here seems to be exports and format conversions generally.
This underscores the need (particularly in the OmniOutliner case) for a method which allows the excellent omniJS to return a value resulting from the evaluation of a submitted script.
TaskPaper’s analogous use of a JS Context provides a good model - a few wrapping lines of JavaScript for Automation or AppleScript:
- Submit a JS script text for evaluation (perhaps with some key-value pairs for options)
- get a return value back (could be string, list/array, record/dictionary, or number)
- do something with that return value, perhaps saving it, for example, to a file.
Why not do it all in AppleScript / JXA ?
Because OmniJS is much faster, has an easier scripting interface, and works on iOS versions of Omni apps too.
Why not do it all in omniJS ?
Because a JS Context, while very fast and wonderfully cross-platform, doesn’t have access to the file-system.
I use AppleScript to manage an OmniOutline based project task manager.
Another script allows emails to be grabbed from Apple Mail extracting transmission time and other data.
I have used it to manage a large file of “things to be tested”, the script counted how many were completed from the total of several hundred and produced a report for management which was output to an email.
Yet another to conduct maths on numbers in columns and put the result in a third column.
Export to Excel with a specific paragraph numbering scheme.
Its really useful !
best wishes
Simon