The Omni Group Forums

The Omni Group Forums (
-   OmniFocus Extras (
-   -   Applescript to automate the backup/restore of DB (

jamesmulcahy 2008-02-16 05:23 AM

Applescript to automate the backup/restore of DB
I'd like to automate the backing up and restoring of the OmniFocus DB. I'm hoping to hook this up such that I can have the DBs on my two machines sync with less manual input.

There doesn't appear to be anything in the OmniFocus Applescript dictionary, and my attempts to try and automate by selecting menu items have failed.

I've used a script like this to try the latter:

[FONT="Courier New"]tell application "System Events"
tell process "OmniFocus" to tell menu bar 1
click menu item "Back Up Database..." of menu "File"
end tell
end tell

But when executing this, I get the following error:

[FONT="Courier New"]of-save.scpt:78:137: execution error: System Events got an error: Canít get menu item "Back Up Database..." of menu "File" of menu bar 1 of process "OmniFocus". (-1728)

Does anyone know what's going wrong here? Is there any easier way to achieve what I'm after?

RobTrew 2008-02-17 11:41 AM

The [I]Archive[/I] method of the document class may be what you need.

e.g. something analogous to:
[CODE]tell application "OmniFocus"
set strPath to ((path to desktop) as string) & "Archive.ofocus"
archive default document in file strPath
end tell[/CODE]

All times are GMT -8. The time now is 07:42 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.