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 Today's Posts

 
Script help for syncing widget Thread Tools Search this Thread Display Modes
When working through my task list, I use a dashboard-centric workflow. I have a widget that has my iCal tasks. To keep working without interruption, I made another widget that sync iCal and Omnifocus when I click on it.

Now I'm adding an iPhone to the mix, and I'm syncing over WebDAV. I'd like to update my syncing widget to:
  1. Sync iCal and Omnifocus
  2. Wait until step 1 is finished
  3. Then sync to the server, so my iPhone is up to speed

I can't figure out what the command I need to sync to the server is. This is what I have now:
Code:
tell front document of application "OmniFocus"
	
	ical_synchronize
	
end tell

quit application "OmniFocus"
I'm working at the bleeding edge of my geek skills here, so if anyone can help me figure this out, I'd really appreciate it.
 
The following code will goose OmniFocus into doing a database sync (if one isn't already in progress) and wait until it completes, or a predefined maximum amount of time passes.

Code:
property MaxTime : 120 -- number of seconds script is allowed to run before giving up
property SleepTime : 5 -- number of seconds between checks to see if sync is still active

tell application "OmniFocus"
	with timeout of MaxTime seconds
		tell default document
			if not syncing then
				synchronize
			end if
			repeat while syncing
				delay SleepTime
			end repeat
		end tell
	end timeout
end tell
 
That's great, thanks. But I actually need it to wait until it's done syncing with iCal and then sync the database, to get my changes from iCal on it. Will the same code work if I replace the syncing commands with the command to sync iCal?
 
Sorry, I missed that!

I don't do iCal syncing with OmniFocus, and as my calendar setup has been acting up a bit lately, I'm not inclined to experiment. There isn't anything in the description of the syncing property that suggests it only applies to one or the other, so I would try duplicating the code structure and use ical_synchronize the first time. It might be okay to skip waiting for the "real" sync to finish if you aren't going to be doing anything after the sync.
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
The greatest widget philonous OmniDictionary 4 2008-11-24 02:13 AM
Feature request: Syncing Dashboard Widget Egregea OmniFocus 1 for Mac 11 2008-10-26 10:05 AM
New widget LawDaddy OmniFocus 1 for Mac 3 2008-07-19 06:13 AM
Widget dhm2006 OmniFocus Extras 0 2007-11-12 04:25 PM
Dashboard widget of tasks pslade OmniPlan General 1 2007-10-22 02:13 PM


All times are GMT -8. The time now is 03:19 PM.


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