The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Hint: Automatically sync with iCal every hour Thread Tools Search this Thread Display Modes
Just a small hint to automatically sync with iCal, iSync and OmniFocus:
  • Start the Terminal
  • Enter "crontab -e"
  • The editor VI is started. Press "i" to enter insertion mode.
  • Paste the following to iSync every hour with the configured device:
    Code:
    27 * * * * osascript -e 'tell application "iSync" to synchronize'
  • Paste the following to sync OmniFocus with iCal a few minutes later:
    Code:
    33 * * * * osascript -e 'tell application "System Events" to click button "Sync with iCal" of tool bar 1 of window "OmniFocus" of process "OmniFocus"'
    Make sure that the iCal sync button is in your OmniFocus toolbar!
  • Press the Escape key and type :wq and finish with the enter key to quit the VI editor.
  • That's it: iCal will sync with your mobile every hour at 27 minutes, OmniFocus will sync with iCal every hour 6 minutes later.

Some more information about the editor VI: http://en.wikipedia.org/wiki/Vi
 
This would be very helpful, but how do you get the iCal sync onto the Omnifocus toolbar?
 
View Menu -> Customize Toolbar

Drag the "Sync with iCal" button.
 
Here is a more advanced shell script to sync. It basically iSyncs twice around one sync of OmniFocus to get every task from and to your mobile device. You can easily adapt it to your needs:

Code:
#!/bin/sh

# quit iSync (because somehow it is more reliable with my mobile with a fresh iSync)
osascript -e 'tell application "iSync" to quit'
sleep 5

# sync and wait
osascript -e 'tell application "iSync" to synchronize'
while [ `osascript -e 'tell application "iSync" to syncing'` = "true" ]; do
      sleep 1
done

# sync OmniFocus
osascript -e 'tell application "System Events" to click button "Sync with iCal" of first tool bar of first window of process "OmniFocus"'
sleep 15

# sync iSync again
osascript -e 'tell application "iSync" to synchronize'
while [ `osascript -e 'tell application "iSync" to syncing'` = "true" ]; do
      sleep 1
done

# quit iSync
osascript -e 'tell application "iSync" to quit'
Stefan
 
The script doesn't work for me. I get:

36:124: execution error: System Events got an error: Can’t get window "OmniFocus" of process "OmniFocus". (-1728)

Being relatively new to Macs (but loving it!), I don't really want to go poking around too much in terminal. Is the script still valid for the latest builds? It would be great if there was an "automatically sync every x minutes" in the preferences.

Thanks for any help.
 
It seems to be broken. Will take a look... Thanks for pointing that out!

Stefan
 
In fact it's much easier now:

Code:
tell application "OmniFocus" to ical_synchronize first document
Hence the cron entry will be:

Code:
33 * * * * osascript -e 'tell application "OmniFocus" to ical_synchronize first document'
And the whole script:

Code:
#!/bin/sh

# quit iSync
osascript -e 'tell application "iSync" to quit' > /dev/null
sleep 5

# sync and wait
osascript -e 'tell application "iSync" to synchronize' > /dev/null
sleep 3
while [ `osascript -e 'tell application "iSync" to syncing'` = "true" ]; do
      sleep 1
done

# sync OmniFocus
osascript -e 'tell application "OmniFocus" to ical_synchronize first document'
sleep 15

# sync iSync again
osascript -e 'tell application "iSync" to synchronize' > /dev/null
sleep 3
while [ `osascript -e 'tell application "iSync" to syncing'` = "true" ]; do
      sleep 1
done

# quit iSync
osascript -e 'tell application "iSync" to quit' > /dev/null
 
So, correct me if I'm wrong, if I only want to sync OmniFocus with iCal every 15 minutes, all I put in the crontab is:
Code:
1 * * * * osascript -e 'tell front document of application "OmniFocus" to ical_synchronize'
16 * * * * osascript -e 'tell front document of application "OmniFocus" to ical_synchronize'
31 * * * * osascript -e 'tell front document of application "OmniFocus" to ical_synchronize'
46 * * * * osascript -e 'tell front document of application "OmniFocus" to ical_synchronize'
And that's all?
 
Yes, that did the job. Thanks, Schimmi!

NETZACH: Use "1,16,31,46" (without the quotes) as the first parameter and combine your four lines into one.
 
The latest version of this script looks like exactly what I need, but I'm new to this and therefore a little unclear where the all the pieces go. I enter the cron info in the VI editor, but where do I enter (and save?) the "whole script" ?

Thank you!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do devices sync automatically via omni sync macgrl OmniFocus Syncing 2 2012-03-18 12:48 PM
Moving to OF from Palm/Missing Sync/ical - can I import from ical? Don Richmond OmniFocus 1 for Mac 6 2009-09-03 07:00 AM
Syncronize with iCal every xx minutes, automatically Fontanitum OmniFocus 1 for Mac 1 2009-07-13 09:11 AM
Applescript? to automatically sync with iCal Hayl iCal Sync 1 2008-10-03 05:57 PM
Leveling Hour By Hour hngtme OmniPlan General 1 2007-08-22 11:28 AM


All times are GMT -8. The time now is 05:40 AM.


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