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

 
Script to copy iCal todos into Omnifocus inbox? Thread Tools Search this Thread Display Modes
Hi guys

I have a Nokia 2865 phone which I sync with my mac. This lets me sync todos to iCal along with my calendar and address book. I can get to my todo list with a single button press from the home screen of the Nokia.

I currently use my phones todo list as an inbox to capture events, actions or ideas which I can then sync to my mac when I get home to process them into Omnifocus and delete them from the to do list in iCal.

I have just installed Omnifocus and am wondering how it would be possible to script the process of copying the note title (that's all that the notes contain) and then making these as new inbox items in Omnifocus. I did a google search and forum search but couldn't find anything.

I have zero scripting experience but am reasonably clued up about macs and would be happy to troubleshoot it with someone else who was a bit more experienced in writing applescripts.

Thanks, Daniel.

EDIT: I realised this would be better in OmniFocus Extras forums so I reposted it here. I would remove this post but I can't.

Last edited by danielcompton; 2010-09-04 at 01:17 AM.. Reason: Realised this should go in OmniFocus Extras
 
Hi guys

I have a Nokia 6120 phone which I sync with my mac through iSync. It runs Symbian 3rd edition FP1. This lets me sync todos to iCal along with my calendar and address book. I can get to my todo list with a single button press from the home screen of the Nokia.

I currently use my phones todo list as an inbox to capture events, actions or ideas which I can then sync to my mac when I get home to process them into Omnifocus and delete them from the to do list in iCal.

I have just installed Omnifocus and am wondering how it would be possible to script the process of copying the note title (that's all that the notes contain) and then making these as new inbox items in Omnifocus. I did a google search and forum search but couldn't find anything.

I have zero scripting experience but am reasonably clued up about macs and would be happy to troubleshoot it with someone else who was a bit more experienced in writing applescripts.

Thanks, Daniel.

Last edited by danielcompton; 2010-09-04 at 05:06 AM.. Reason: I needed to update my phone model
 
The file from the Nokia is a text file of simple lines without any substructure, where each line needs to become an inbox item name ?

(I remember an earlier Nokia setup in which each note was a separate text file, and did sketch a script for that, but I imagine the current setup might be a bit different).

--

Last edited by RobTrew; 2010-09-04 at 03:45 AM..
 
Hi Rob, I didn't realise that was how it worked. The phone is running symbian 3 and is a 6120. My last Nokia was a 2865 and I got the two confused.

I'm more interested in solving this via the route of - Nokia to do >sync to iCal > create new note in the OF inbox > delete old note. I currently sync via bluetooth and it works really simply and syncs contacts and my calendar as well.

I'm not sure how to do this but in my head it would be
1. Sync with phone
2. Get title of first to do
3. Make new OF action from title
4. Delete to do
5. Repeat 2-4 until number of to do's is 0.

My thought for a slightly more advanced version would be to have the script only copy across and delete notes that started with a ".". That way I could start a OF action by first placing a period and then writing the note into my phone and still have the option of using the to do as a list for things to check off. That would be a lot more complex though...
 
Something like this - Be Careful!!!! This would delete all of the todos from iCal.

Code:
tell application "iCal"
	set theCalendars to every calendar
	repeat with theCalendar in theCalendars
		set theTodos to every todo in theCalendar
		repeat with theTodo in theTodos
			set theTodoSummary to summary of theTodo
			tell application "OmniFocus" to tell default document
				make new inbox task with properties {name:theTodoSummary}
			end tell
			delete theTodo
		end repeat
	end repeat
end tell
Chris
 
Thanks heaps Chris, that's perfect. When I get a bit more proficient with Applescript I might twiddle to add further features but this is awesome.

Much thanks, Daniel.
 
I fiddled a bit more and looked at this site to get a bit more info and I have cobbled cjlemonier's script together with the one at the link.

Now you just need to activate the script and it will sync the phone and mac and 'cut' the todos synced from the phone/iCal to do list and paste them into the Omnifocus inbox. The other change is that this now activates iSync if it wasn't running and then closes it after the script has run.

Here it is, again be careful anyone else running this because this will delete todos from iCal.

Code:
tell application "System Events"
	set iSyncIsRunning to (count of (every process whose name is "iSync")) > 0
end tell

tell application "iSync"
	activate
	synchronize
	-- wait until sync status != 1 (synchronizing)
	repeat while (syncing is true)
	end repeat
	set syncStatus to sync status
	set lastSync to last sync
end tell

tell application "iCal"
	set theCalendars to every calendar
	repeat with theCalendar in theCalendars
		set theTodos to every todo in theCalendar
		repeat with theTodo in theTodos
			set theTodoSummary to summary of theTodo
			tell application "OmniFocus" to tell default document
				make new inbox task with properties {name:theTodoSummary}
			end tell
			delete theTodo
		end repeat
	end repeat
end tell

if syncStatus = 2 and not iSyncIsRunning then
	tell application "iSync" to quit
end if
This is my first applescript and there are possibly errors or bad practices in the way that I've done this but it seems to work for me.
 
This is a further update on the script, it launches OmniFocus if it wasn't running already and hides it from view (whether or not it was running). I got help from here. Ideally the script would leave OmniFocus at whatever window focus it was originally at (or hidden) and close it after if it was not already open. That will have to wait for another day though when I actually understand what to do and not just how to copy and paste :p.

I'm not sure why but it apparently helps telling OF to activate twice (according to the link). It's not as elegant as I would like but it gets the job done :).

Code:
tell application "System Events"
	set iSyncIsRunning to (count of (every process whose name is "iSync")) > 0
end tell

tell application "OmniFocus" to activate
tell application "OmniFocus" to activate
tell application "Finder"
	set visible of process "OmniFocus" to false
end tell

tell application "iSync"
	activate
	synchronize
	-- wait until sync status != 1 (synchronizing)
	repeat while (syncing is true)
	end repeat
	set syncStatus to sync status
	set lastSync to last sync
end tell

tell application "iCal"
	set theCalendars to every calendar
	repeat with theCalendar in theCalendars
		set theTodos to every todo in theCalendar
		repeat with theTodo in theTodos
			set theTodoSummary to summary of theTodo
			tell application "OmniFocus" to tell default document
				make new inbox task with properties {name:theTodoSummary}
			end tell
			delete theTodo
		end repeat
	end repeat
end tell

if syncStatus = 2 and not iSyncIsRunning then
	tell application "iSync" to quit
end if
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete iCal ToDos harringg iCal Sync 2 2011-10-11 01:33 AM
Is there a script to copy OF actions (and notes) to Journier? peterlemer OmniFocus Extras 1 2011-05-11 06:13 PM
Duplicate entries in iCal & OmniFocus, or items being moved to OF inbox Fontmedia iCal Sync 21 2010-06-26 08:27 PM
Script to copy columns (and any selected rows) to new doc RobTrew OmniOutliner 3 for Mac 0 2010-06-07 02:47 AM
Copy column script DerekM OmniOutliner 3 for Mac 8 2009-01-27 01:40 PM


All times are GMT -8. The time now is 01:53 AM.


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