The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   AppleScript to sync and then quit? (http://forums.omnigroup.com/showthread.php?t=31371)

luomat 2014-03-13 02:07 PM

AppleScript to sync and then quit?
 
I am trying to get OmniFocus to sync and then quit itself once it has finished syncing.

Somewhere along the way I found this AppleScript to tell OmniFocus to sync:
[CODE]
osascript << EOI
if application "OmniFocus" is running then
tell application "OmniFocus"
synchronize front document
end tell
end if
EOI
[/CODE]

However, I noticed that AppleScript seems to just tell OmniFocus to do that, but it 'returns' before the sync is actually finished.

1. Is there a way to tell OmniFocus to "Sync and Then Quit" using AppleScript, and if so, how?

2. Am I correct that if I choose 'Quit' from OmniFocus' menu, and it needs to sync first, it will attempt to do so before quitting?

(If the answer to #2 is yes then I don't really need an answer to #1, except out of curiosity.)

Ken Case 2014-03-16 11:13 AM

[QUOTE=luomat;129858]1. Is there a way to tell OmniFocus to "Sync and Then Quit" using AppleScript, and if so, how?[/QUOTE]

OmniFocus automatically waits for syncing to finish before quitting, so you the app to sync and then quit, and it will wait for the*sync to finish:

[CODE]tell application "OmniFocus"
synchronize
quit
end tell[/CODE]

But presumably this is academic, since…

[QUOTE]2. Am I correct that if I choose 'Quit' from OmniFocus' menu, and it needs to sync first, it will attempt to do so before quitting?[/QUOTE]

Yes, if OmniFocus has any edits on the local device which it hasn't already synchronized (which it normally does within 2 minutes), it will automatically try to synchronize them before it exits.

luomat 2014-03-17 11:09 PM

Excellent
 
Fantastic! Thanks for the info.


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

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