Hi, I need help building an AppleScript; I’m a bit out of my depth.
Problem: I have dozens of legacy .MORE outline files on my hard drive in relevant folders. OmniOutliner 4 no longer opens MORE files. I want to convert the files to .OO3 files in the same location as the original.
I still have an installed license of OO3Pro. I also have a list of every MORE file, and it’s exact file path.
Solution: Use an AppleScript to go through the path list, find each MORE file, open it in OO3Pro, save it to the same path location as an .OO3 file, and then change the label color of the MORE file to indicate that it’s been processed.
I don’t have OO, so this is “off the top of my head” if you will. I’d wonder whether this has to be done via AppleEvents to control the menu commands. Essentially, you would …
read the file list
tell application “OO3Pro” …
for each file
– open
– run AppleEvents to handle conversion via menu commands
– run AppleEvents to handle duplicate/save as via menu commands
– run AppleEvents to handle save via menu commands
Here’s a script which will prompt you for a folder, find all the *.more documents inside that folder, and tell OmniOutliner 3 to open them and write them all back out as *.oo3 documents.
This script assumes you’ve just downloaded (and opened) OmniOutliner 3 Professional from our website, though you can change that assumption by editing the first few lines of the script.
-- This assumes you've downloaded OmniOutliner 3 Professional from <http://files.omnigroup.com/software/MacOSX/10.4/OmniOutlinerPro-3.10.6.dmg> and that the disk image is currently open. It runs the app directly from that disk image so you can just eject it when you're done and not pollute your hard drive with the older app.
-- To run OmniOutliner 3 Professional from a different path, just change this version3Path declaration
global version3Path
set version3Path to "/Volumes/OmniOutliner Pro/OmniOutliner Professional.app"
-- First, prompt the user for the folder containing their MORE documents and find all the *.more files in that folder
set folderName to quoted form of POSIX path of (choose folder)
set findResults to (do shell script "find " & folderName & " -name '*.more' | sed 's#//#/#'")
set moreFiles to every text item of splitString(findResults, return)
-- Now iterate through all those files and convert them
repeat with moreFile in moreFiles
convertMoreFile(moreFile)
end repeat
on convertMoreFile(moreFile)
log "Converting " & moreFile
tell application version3Path
-- MORE documents can end up turning into multiple OmniOutliner documents, so we need to close all open documents before opening a MORE document so we can save every document that's still open afterwards
close documents
-- Tell OmniOutliner to open the MORE document
open moreFile
-- Save each document to its own file (*.more.oo3, *-2.more.oo3, *-3.more.oo3, etc.)
log "... saving " & moreFile & " as " & (count documents & " documents")
set documentIndex to 1
repeat with convertedDocument in documents
if documentIndex > 1 then
set suffix to "-" & documentIndex
else
set suffix to ""
end if
set targetFile to moreFile & suffix & ".oo3"
log "... saving " & targetFile
save convertedDocument in targetFile
close convertedDocument
set documentIndex to documentIndex + 1
end repeat
end tell
end convertMoreFile
-- This is just a little utility function to split the lines of output returned by the UNIX find command
on splitString(theString, theDelimiter)
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to theDelimiter
set theArray to every text item of theString
set AppleScript's text item delimiters to oldDelimiters
return theArray
end splitString
Thanks Ken, could I get a little more help, please?
Turns out I have 500+ MORE files scattered across many folders, most in project-specific locations. I have a path list for every file in a text file saved from a Spotlight search.
I need to have a script read a path from the list, open MORE file, convert it to OO3 and save to the same location, and then move the MORE file into a collection folder so I know which ones are converted and can be discarded. The script would loop through the list for 500+ entries.
The hardest part for me is reading from the path text file and using the path.
The easiest way to do the conversion without needing to make any changes to the above script is …
Create a Smart Search for the *.more files
Create a new folder
COPY the files from the Smart Search to the new folder
Do the conversion inside the new folder
That leaves the problems of moving the new OO3 files to the proper location (… this is a tough one …) and of deleting the old *.more files (just delete them … but not until the first problem is solved).
I suspect that a clever answer to your problem may involve the use of a “with recursion” switch on the shell find command as well as a “start at the Documents folder” approach. Otherwise or perhaps in addition, as you note, the script will have to store the path command to the file it finds so that it can return the conversion to that same folder.
Thanks for the suggestion. The thought of pulling out 500+ files from their proper locations makes me queasy.
I have a return-delimited list of paths to every MORE file. Isn’t there a way to parse that one line at a time, open the file by path, convert it, then save it to the same path with an .oo3 extension?
You could use the input of that file to feed to the conversion routine as a handler. The modification might start by wrapping the code in a function.
on DoMe(filepath)
...
set folderName to quoted form of POSIX path of filepath
Unfortunately, I don’t have any first hand experience in this. All that I can recommend is “off the top of my head”. I cannot even pull a snip of code from something else to paste in place.
My best suggestion at this point is to bite the bullet and do the brute force approach. Someone might otherwise provide a workable code along this line.
The script I shared above solves this already. Just point it at a folder—or even an entire disk—and it will find every file inside that folder (including all subfolders) and convert all of the documents it finds.
Unfortunately, my system is on OSX Sierra and OO3 will not launch.
Short of downgrading my system or setting up an alternate boot drive in an older system, is there any way to convert these .MORE files?
Is there any way to use the deprecated code to make a conversion script or small app? Maybe I could find a kind coder who could put it together if you gave me permission.
I’m trying to convert as many as 1,000 old MORE outlines, and this AppleScript looks perfect. I’ve been able to resurrect an original MacBook Pro (running Snow Leopard) with OO3 Professional. I can indeed convert my MORE files one at a time on this machine.
I downloaded the AppleScript above, to the machine. Unfortunately, it doesn’t seem to be working for me.
I’m thinking that the problem is the “version3Path”. OmniOutliner Professional.app is in the Applications folder. What is the verbiage that I need to use to get the path right? I’ve tried every variation that I can think of. Thank you.
Good news and bad news (for me). I DID get the script to work. The problem is that these files were created before we were using extensions on the Mac. Besides my test files, none of my approximately 1000 MORE files have the .more extension.
Is there any quick way to add that extension? My Snow Leopard machine does recognize the files as MORE files — it has the little MORE icon on each one.
set version3Path to "/Applications/OmniOutliner Professional.app"
I should note that OmniOutliner 3 no longer runs on the latest versions of macOS (i.e. 10.13 High Sierra or 10.14 Mojave): it had a good run (its first public release was in 2004, and its latest update was in 2012), but all the years of operating system updates finally left it behind. But you can still use it on older versions of macOS, if you have those around. (I’m running Mojave, but I also keep copies of older operating systems around in VMware Fusion to use as needed.)
Is it possible to run OmniOutliner3 and the AppleScript in an older OS using VMware Fusion and convert documents that are on drives on the main machine?
You can use file sharing in VMware Fusion to do this, yes.
That said, I thought you all might be interested to know that today’s test builds of OmniOutliner 5.10 once again include support for reading MORE documents:
An unfortunate caveat: if any of your MORE documents include graphics you’ll probably want to use the VMware approach since modern versions of macOS are no longer able to render graphics stored in the old PICT format. (5.10 imports these graphics as .pict file attachments, so you can get your data out again later. But v3 used to be able to convert those images to TIFF, which was better than just getting an opaque file attachment.)