Script to change URL / link formatting?


#1

Hi,

I’m seeking assistance for setting up scripts to automate certain functions in OmniOutliner. I’m using MarginNote, an app that annotates documents and exports those annotations as discrete notes, to export those annotations in OmniOutliner. The wonderful folks at OmniGroup have helped me build scripts that neaten up the formatting for MarginNote-exported - OmniOutliner files.

I’m seeking a script that can change the formatting for the URL links in the Page No column, which appear like this…

Basically, I’m seeking a script that will enable me to covert the >> links with actual MarginNote URL links.

IOW, change >> to marginnote3app://note/D4B1D675-564E-41F6-AFBE-106628DAC234and also delete the page numbers, just above the links.

I’d appreciate any help anyone could provide… Thank you!


#2

Any ideas or suggestions…?

Thanks!


#3

Select a row you wish to affect and run this applescript:

tell application "OmniOutliner"
set c5 to a reference to cell 5 of selected row of document 1
set l5 to value of attribute "link" of style of character -1 of text of c5
set text of c5 to l5 as text
end tell

Breakdown:

  • Identify the target cell of the selected row (NB ‘Topic’ column is actually ‘2’ so in your example, ‘Page No’ is ‘5’)
  • Grab the URL from the last character of that cell
  • Replace cell text with that URL (NB ‘as text’ may not be required)