PDA

View Full Version : new sync to iPod script


RodCloutier
2007-08-03, 05:17 AM
Here is a script for those of us who want to carry around a quick access to our Omnifocus info with our iPod.

Since iCal todo list removes the context information I have written a script that creates notes our your iPod that replicates the projects view and the context view.

Features:

Export all Projects, folders and all actions
Export Contexts view that only shows the next action.
Export the content of the note for each action


You need to update the script with your iPod volume name, connect your iPod and your are good to go!

On your iPod, navigate to Extras->Notes->OmniFocus.

Enjoy and feel free to give feedback!

Rod

The latest file is available here OmniFocus iPod exporter (http://curlyfrog.com/blog/?page_id=8)

sprugman
2007-08-03, 05:08 PM
I tried using this, and I'm getting the "Failed to find iPod" error, even though /Volumes/myPod/Notes exists.

Any hints?

granin
2007-08-05, 09:36 AM
I tried using this, and I'm getting the "Failed to find iPod" error, even though /Volumes/myPod/Notes exists.

Any hints?

Exactly same problem! Did anyone make it work the right way ?

ipod name: "MISHA'S IPO"

Craig
2007-08-05, 09:52 AM
I'm wondering if the apostrophe (') throws things off. I too had problems, and I too have an apostrophe in my iPod's name.

granin
2007-08-05, 10:08 AM
I'm wondering if the apostrophe (') throws things off. I too had problems, and I too have an apostrophe in my iPod's name.
for now i just removed checking code, remove this form script:

tell application "Finder"
if not (exists folder "Notes" of POSIX file iPodPath) then
set dialogButtons to {"OK"}
set msg to "Failed to find iPod " & iPodVolume & "." & return & "Script will stop."
set defaultBtn to "OK"
end if
end tell

RodCloutier
2007-08-07, 07:10 PM
Sorry I didn't reply any sooner. If it is only the checking code, it is safe to remove it. I will look into it tomorrow. My guess is that I have to use the quoted form of the path in the checking code. Something similar to

tell application "Finder"
if not (exists folder "Notes" of POSIX file (quoted form of iPodPath)) then
set dialogButtons to {"OK"}
set msg to "Failed to find iPod " & iPodVolume & "." & return & "Script will stop."
set defaultBtn to "OK"
end if
end tell

Anything else bugging you?

Rod

granin
2007-08-07, 08:16 PM
requests for now:
1 i use a lot of forbidden symbols in projects and contexts names like :,;/ etc, and my iPod is Windows formatted to use it as a external drive to exchange files with Windows folks. Is it possible to implement some replacement of forbidden characters?
2 my single actions usually are not related to any project (just to speedup the entering process), so they are notsynched to iPod! But most of my Errands and To Buy ARE single actions! - is it possible to
sync all actions without a project? I'm opened to change my workfolw - any other ideas on this are welcome!

RodCloutier
2007-08-08, 05:09 AM
I use a lot of forbidden symbols in projects and contexts names like :,;/ etc, and my iPod is Windows formatted to use it as a external drive to exchange files with Windows folks. Is it possible to implement some replacement of forbidden characters?

I can certainly do that. Out of curiosity, are those ( :,;/ ) the only symbols you are using?

My single actions usually are not related to any project (just to speedup the entering process), so they are not synched to iPod! But most of my Errands and To Buy ARE single actions! - is it possible to
sync all actions without a project? I'm opened to change my workfolw - any other ideas on this are welcome!

I will have a look if I can export actions without projects. You could, in the meantime, create a "Single actions" projects and put all your single actions in that project.

A new version that automatically detects the connected iPod, with pretty icon, is available here OmniFocus iPod exporter (http://curlyfrog.com/blog/?page_id=8)

I have also changed the name of the scripts to "ExportToiPod" since it looks a lot nicer in the toolbar.

Rod

RodCloutier
2007-08-12, 05:07 PM
1 Is it possible to implement some replacement of forbidden characters?
Done

2 is it possible to sync all actions without a project?
You now can do so but only if the task has a context. It will show up in the context view with the default project "Single Actions". This can be changed at the top of the file.

Rod
OmniFocus iPod exporter (http://curlyfrog.com/blog/?page_id=8)

jaywest
2007-08-16, 05:11 PM
This OmniFocus iPod Exporter looks fantastic but I can't seem to get it to work. There are no installation or usage instructions so I am really having to guess how to get it to work.

The script seems to run properly with approriate prompts and with no errors but it does not add any note files to my iPod. I tried it without the iPod attached to see if it would throw an error, which it doesn't, so I am assuming there music be something wrong with the script or my setup.

Can you elaborate how to use and troubleshoot this script? Where is it installed? When do you run it? Does the iPod need to be in Disk Mode at the time the script is run?

Thx

RodCloutier
2007-08-17, 04:37 AM
This OmniFocus iPod Exporter looks fantastic but I can't seem to get it to work.
Thanks. I am sorry that it doesn't work. I will try to help you.

There are no installation or usage instructions so I am really having to guess how to get it to work.
Good observation. I will add some information on my website.


Can you elaborate how to use and troubleshoot this script?
Are you using the latest version or the version that used to be posted in this thread? The latest version will check properly for the iPod attached to your computer.

Can you tell me which model of iPod you have? Quoting Apple, "The Notes feature is available on iPods that have a dock connector. This includes iPod mini, iPod (with Dock Connector), and iPod (Click Wheel) models." so will the script. I will add a check for that.

Where is it installed?When do you run it?
It can be run as a standalone script through the script editor or you can install in your ~/Library/Scripts/Applications/OmniFocus directory. You can then customize your toolbar to have a button to show the script.

Does the iPod need to be in Disk Mode at the time the script is run?
Yes, you must enable Disk Mode to have the script to work properly.

Rod
OmniFocus iPod exporter (http://curlyfrog.com/blog/?page_id=8)

olderbrother
2007-08-23, 11:46 AM
Thanks, Rod, for this great script. I have but one request: not limiting the Context view to only next actions. I'd most like to use OmniFocus on my iPod for my errand list, and when I'm out and about I'd like to see "buy milk" and "buy eggs" rather than just whichever one happens to be the next action.

Is that doable? I'm wondering why you decided to limit it to next actions to begin with - available actions would be better for me.

Thanks!
David

granin
2007-08-23, 05:05 PM
Great update!
Another thing i really need - I have 137 proejcts with 290 available tasks. and 619 remaining tasks so if I use your script as is then it exceeds maximum number of notes that IiPod supports (1000 notes) so I have to edit each new version of your script to remove syncing of projects and sync only contexts. Could you make it an option or just make another version of script or make it easy to change the code so I could use to sync only contexts?

jaywest
2007-08-23, 05:59 PM
Thanks for the help Rod. I am using v0.3 downloaded directly from your site. I have the latest generation of the video iPod. I have opened the script in Script Editor and enabled disk use through iTunes. I run the script and I get the "Exporting to iPod" prompt. I click OK and then script seems to run for about 30 seconds until it comes back with the "Done!" message. It doesn't give me error message even though I see you have some error checking in the script. I check the Notes folder both through the iPod UI and through the Finder and there is nothing in that folder.

The script seems to run without error and seems to produce some result but it seems it is not putting it on the iPod? Any ideas?

jaywest
2007-08-23, 06:45 PM
Just to update my previous post.... I found the "OmniFocus" folder this script created... it was sitting at the root of my hard drive in a folder called "Notes". So it would seem to me that the script has a problem detecting the difference between my iPod drive and my MacBook drive. What would I need to do to remedy this so the script writes to the iPod?

ext555
2007-08-24, 05:24 AM
I installed and ran the script with no problem .. but it says " no iPod detected " script will stop .. I took the ' out of my ipod name .. not sure what else might be wrong ?

RodCloutier
2007-08-24, 11:37 AM
Thanks, Rod, for this great script. I have but one request: not limiting the Context view to only next actions.

You are welcome. Limiting to Context view can be easily done. I will work on a dialog to specifiy options as soon as I come back from vacation (early september). In the mean time, I think (not tested though) you can change the line(135) :

set nextAction to next of firstTask

to

set nextAction to true


Rod

RodCloutier
2007-08-24, 11:39 AM
Great update!

Thanks!

Could you make it an option or just make another version of script or make it easy to change the code so I could use to sync only contexts?

I wasn't aware of the 1000 file limit. Maybe I need to rethink the way it is done and provide an option to store the task in files instead of using a file for each task. I will see. As I mentioned in my previous reply, I will work on a set of options for the script. (Not before early September though)

For the time being, as you probably already know, you can disable (prefix with -- or remove) the following line from the script:

createProjectFilesOrFolders(topLevelProjectsAndFol ders, projectsPath)

Rod

RodCloutier
2007-08-24, 11:43 AM
Just to update my previous post.... I found the "OmniFocus" folder this script created... it was sitting at the root of my hard drive in a folder called "Notes". So it would seem to me that the script has a problem detecting the difference between my iPod drive and my MacBook drive. What would I need to do to remedy this so the script writes to the iPod?

Hmm. I haven't seen this behavior before. Do you have, by any chance, a iPod_Control directory at the root of your MacBook ?

You could always try to change the following line(44), replacing your_iPod_name_here by the name of your iPod:

set omniFocusPath to (POSIX path of iPodPath) & "/Notes/OmniFocus"

to

set omniFocusPath to "/Volumes/" & "your_iPod_name_here" & "/Notes/OmniFocus"


Rod

RodCloutier
2007-08-24, 11:44 AM
I installed and ran the script with no problem .. but it says " no iPod detected " script will stop .. I took the ' out of my ipod name .. not sure what else might be wrong ?

What generation of iPod do you have? The script works with the latest generation of iPods that support the Notes.

Rod

olderbrother
2007-08-24, 12:04 PM
Thanks, Rod, it worked. I can now see all actions, not just the "next" ones.

However, I'd rather not see the actions I've already completed! I know you're headed out for a well-deserved vacation, but I hope sometime you can take a look at the option of showing just "available" actions.

Your quick, helpful responses are very appreciated.

David

jaywest
2007-08-27, 08:08 AM
Hard coding my iPod name into the script seems to have fixed the problem I mentioned earlier in this thread.

frosty
2007-08-28, 04:06 PM
Thanks, Rod, it worked. I can now see all actions, not just the "next" ones. However, I'd rather not see the actions I've already completed!

Hi David,

Having a quick look at the script, I would say you should be able to change line 135 to:

if (completed of firstTask is false) then
set nextAction to true
else
set nextAction to false
end if

I haven't tested it thoroughly, but it seeeeeems to work for me. :)

frosty
2007-08-28, 04:13 PM
I've made one other modification to my copy of the script. I've replaced line 148:
set fileContent to "[" & projectName & "]" & return & note of firstTask

with:
if (note of firstTask is missing value) then
set fileContent to "[" & projectName & "]" & return & name of firstTask
else
set fileContent to "[" & projectName & "]" & return & name of firstTask & return & note of firstTask
end if

This achieves two things:
1) It now just doesn't print a value if an action has no note (instead of printing 'missing value')
2) The names of my actions weren't fitting on my iPod's screen (I'm using a Nano), so I've made it write the name of the action inside each action, as well (where I can read it).

Hope that's useful to someone! :)

olderbrother
2007-08-29, 05:54 PM
Thanks, frosty, for advising me how to change line 135. I haven't tried it yet, but when I do, I think I'll use "blocked" instead of "completed" - that should give me only available actions rather than all remaining actions. I'll report back if it doesn't work as expected.

--David

olderbrother
2007-08-30, 09:13 AM
One correction to my last post. THIS is what seems to work for syncing only available actions. Replace line 135 with this:

if (completed of firstTask is false) and (blocked of firstTask is false) then
set nextAction to true
else
set nextAction to false
end if

This is one of my first forays into AppleScript, and it's fun (when I have the time).

--David

arthurlewis
2007-09-12, 04:52 AM
This script looks great, but I haven't been able to make it work. Whenever I try it, I get a "stack overflow" error, even when I comment out the "createProjectFilesOrFolders(topLevelProjectsAndFol ders, projectsPath)" line. I have 3 levels of nested contexts, so I assume that's at least part of what's causing it?

I'm pretty new to Applescript, but I may tinker with the script somewhat this weekend, unless someone has already implemented what I'm looking for. Has anyone found a way to target just certain contexts (I only need two of them on my iPod) and thus remove the recursion inherent in loading up all those nested contexts?

Luke5
2007-09-12, 11:01 AM
The script is great. I also can't get it to work completely.

I get a "stack overflow". It stops on "replace_chars(this_text, firstItem, "_")".

When I check the iPod the Projects folder seems complete but the Contexts folder is empty.

RodCloutier
2007-09-13, 06:18 AM
I have made some modification to the script. I will try to put it online this weekend and have a look at the overflow problem.

Targetting context should be fairly easy. I will have a look at that too.

Rod

bokonon38
2007-10-02, 06:55 AM
Hi.

First of all I really want to thank for the script because it was really what I was looking for.. the ipod is with me almost all the time and so I can have my project/context overview at hand anytime..

but still I have a question: due to the recent (weird and widely discussed) division of NEXT and AVAILABLE actions I need to be able to export not only the NEXT actions but all of the AVAILABLE actions.. the above mentioned change in the script exports ALL the actions - including those already finished..

would there be a way to go around this??

thanks a lot!!

halbtuerke
2007-10-04, 08:13 AM
Thanks for this amazing script.

The only question I have is how I can get rid of the completed tasks in the project view? In contect view there are only the available actions but when I go into project view it lists also the completed ones.


Thanks in advance

KiltedGreen
2007-11-17, 01:18 PM
This looks to be lovely, but just as people have been experiencing with the iPhone script, I'm getting the "Missing parameter for activate" message and the script stops. I'm using the latest version on CurlyFrog's site and Leopard 10.5.1

Melan
2007-11-20, 10:58 PM
Ok this question is going to reveal me as a total noob but I don't seem to have a ~/Library/Scripts/ in which to find the folder that I'm supposed to copy the script into. What gives?
EDIT: also, what line in the script do I change to my iPod's name?
If I run the script right now it says "OmniFocus got an error: Some parameter is missing for activate."

halbtuerke
2007-11-21, 02:02 AM
Ok this question is going to reveal me as a total noob but I don't seem to have a ~/Library/Scripts/ in which to find the folder that I'm supposed to copy the script into. What gives?
EDIT: also, what line in the script do I change to my iPod's name?
If I run the script right now it says "OmniFocus got an error: Some parameter is missing for activate."

Just create the directory ~/Library/Scripts/Applications/OmniFocus and place the script in there.

I think the script locates the iPod on its own but I could be wrong. Maybe something is broken. Could someone confirm this issue?


Greetings

Melan
2007-11-21, 05:16 PM
Aha that works, thanks.

Just to clarify, the script goes wrong at the very first 'activate'. Guess I have the same problem as KiltedGreen

RodCloutier
2007-11-21, 07:14 PM
If I run the script right now it says "OmniFocus got an error: Some parameter is missing for activate."

Remove the line containing activate. It seems activate is not really needed anymore.

I will try my best to update the script with more functionality but I can't promise anything with baby coming soon...

Rod

Melan
2007-11-21, 11:02 PM
Ahhhh thanks, removing 2 of the activates solved the problem. It works great!

PS congratulations on the baby

Mats
2008-01-11, 12:42 PM
This script looks excellent; unfortunately I get the following errormessage:

The script 'ExportToiPod.scpt' could not complete.

AppleScript reported the following error:
OmniFocus got an error: Some parameter wasn't understood.


Any advise/input would be greatly appreciated.


OmniFocus 1.0 (v77.1.2.0.96900)
Mac OS X 10.4.11

matthewbate
2008-05-07, 08:13 AM
I've had most of the above, but a couple of tweaks has got me to the stage where I'm getting the following;

"AppleScript reported the following error:
OmniFocus got an error: Can’t get every task of folder id "ihkmMbSGR3Y" of document id "fs1UqBP8c6n"."

My iPod has both project and context directories but only the project one is full. My iPod does not think there is anything in the directories. I suspect, looking at the names of the files, that there are many more tasks than I have currently outstanding so I might be getting completed tasks as well.

A search, which did include invisible items, has not revealed either the file or folder names.

Any help would be appreciated, thanks.

matthewbate
2008-05-07, 08:14 AM
A couple of tweaks HAVE got me...

My brain hurts.

hagure
2008-08-26, 11:49 AM
I've had most of the above, but a couple of tweaks has got me to the stage where I'm getting the following;

"AppleScript reported the following error:
OmniFocus got an error: Can’t get every task of folder id "ihkmMbSGR3Y" of document id "fs1UqBP8c6n"."


Any help would be appreciated, thanks.



Hey... what's probably happening is that one of your folders or project names is duplicated (this happens sometimes when you checkmark all tasks on a reoccurring project). The script's mkdir call fails and halts everything. If I remember correctly, this can happen if you have the same context names (e.g. having a home:freetime context and a work:freetime context) as well.

I know there's an easy way to fix it (a quick change of the cmdlne call i'm sure), but its a little too deep into the "yak" for my talents.

If you run the script in ScriptEditor with the EventLog pane open, you can deduce which thing is duplicated by checking the last log before the error. Instead of a semi-useless "folderid" or something, you'll actually see the full path, and can then check in OF for the duplicate (don't forget to show completed and dropped projects/contexts).

Beware though, this takes FOREVER if you've been using OF for a long time... the script also checks and creates folders for dropped and completed tasks as well, and iterating & logging the whole process took hours for me (I just stopped it after catching and correcting a few dupes, because it was preventing me from GTD).

Wish I had an iTouch or something... but I'm holding out on replacing my Video for at least another rev.

Hope that helped.