Batch conversion?

Has anyone devised a way, via scripting or some other means, to batch update files from the oo3 format to the new ooutline one? If there’s an option in the program or the help that describes how to do that, I’ve missed it so far. Having a lot of different files, I’m loathe to have to open them each individually, click the convert button, choose whether to save a new document, and then save. A few times is fine. Several dozen, not so much.

taj.

1 Like

This script below will save oo3 documents with the new format. Place the oo3 files in a folder, run, and navigate to that folder at the prompt. The script has OO5 open each document and save it. You may have to vary the delay statements on your machine. Make sure only OO5 is running, not previous OO versions.

SG

--place OO3 documents in folder; run and choose that folder at prompt
set fldr to choose folder
tell application "Finder" to set ff to fldr's items
repeat with f in ff
	if f's name extension is "oo3" then
		tell application "OmniOutliner"
			open f
			activate
			delay 0.1
			tell application "System Events" to tell application process "OmniOutliner"
				click window 1's splitter group 1's group 2's button "Convert…"
				delay 0.1
				click window 1's sheet 1's checkbox "Save Converted File…"
				delay 0.1
				click window 1's sheet 1's button "Save"
			end tell
			delay 0.1
			close front document
		end tell
	end if
end repeat

Thanks for that. When I posted yesterday, I had thought about going to the GUI route, and your script is an elegant way of using that method. My results with it generally aren’t very consistent with GUI scripting, though, unless I spend a lot of time adjusting delays. Between yesterday and this morning, I fooled around more with the export functionality in AppleScript and came up with a non-GUI way of doing what I wanted. Here’s my modified version of your script (which also prompts for a destination folder). Hopefully others will find this useful.

taj.

set srcFldr to (choose folder with prompt "Source Folder?")
set destFldr to (choose folder with prompt "Destination Folder?") as string
tell application "Finder" to set ff to srcFldr's items
tell application id "OOut"
	activate
	repeat with f in ff
		open f
		delay 0.5
		set fileName to text 1 thru -5 of (get name of document 1)
		set fileDest to (destFldr & fileName & ".ooutline")
		export document 1 to file fileDest as "com.omnigroup.omnioutliner.xmlooutline-package"
		delay 0.5
		close front document
		delay 0.5
	end repeat
end tell
1 Like

@travieso

Yes, avoiding gui scripting as much as possible is generally a good thing (though I had fun figuring out the UI elements😀).

Your script is probably a better approach for most people on most machines.

BTW, on my machine you can remove the ‘activate’ line in your script and it still runs fine.

SG

Ha ha. Sometimes figuring out UI elements is fun; sometimes (more often) it’s a pain. And you’re right about the “activate” line. I usually include it either when I’m debugging or because I often invoke scripts via Quicksilver and the activate step ensures that I see what’s going on. But it really isn’t necessary. Thanks again.

taj.

Thanks for this travieso! Worked great for me converting dozens of files.

@travieso thanks for the Productivity script, works really fine here!

@travieso thank you for the script! It was what I wanted.

I believe there may be is a significant functional difference between @SGIII and @travieso. @SGIII GUI script will result in the default filetype which is com.omnigroup.omnioutliner.xmlooutline aka “flat file” versus “file package” or previously known as “uncompressed”, even if the previous version of the outline was “uncompressed”.

As I prefer plaintext @travieso com.omnigroup.omnioutliner.xmlooutline-package was the solution I was looking for. “File package” allows me to search using grep and other tools from the command line.