Use Dropbox to Create a Yojimbo iPhone App

by Ken Clark on October 1, 2009

Yesterday I read that DropBox announced their new iPhone app, and it occurred to me that you could set up the Dropbox iPhone app to clip images directly into Yojimbo with very minimal effort.  I was so pumped.  This was a total game changer.

Here’s how to do it:

(Note:  I’m assuming that you have Yojimbo installed on your Mac and Dropbox installed on both your iPhone and Mac.  If not, download Dropbox here and Yojimbo here.)

1. On your Mac, create a new folder called “Clip to Yojimbo” in your Dropbox folder:

Clip to Yojimbo Folder in Dropbox

2.  Copy and past the below code into Script Editor.  This will become a folder action that runs anytime a file is added to the “Clip to Yojimbo” folder (note: you will have to enable folder actions if they are not already set up).  Save the script to your Mac’s Library/Scripts/Folder Actions folder as “import to Yojimbo” or whatever name you like.

on adding folder items to this_folder after receiving these_items
	repeat with x from 1 to the count of these_items
		set theFile to item x of these_items
		try
			tell application "Yojimbo"
				import theFile
			end tell
		end try
	end repeat
end adding folder items to

Note for Scripters:  You can certainly get a little fancier with the Applescript, i.e. move the picture to an archive folder after the import is complete, etc. but this is all you need to get the basic import done.

3.  Assign the “import to Yojimbo” folder action to the “Clip to Yojimbo” folder.

Assign Yojimbo Folder Action

4. That’s it.  Now it is time to test it out.  Go to your iPhone, go to DropBox and navigate to the “Clip to Yojimbo” folder. Take a picture.

Clip A Photo With Dropbox on the iPhone

5. If you are at your Mac, you will see the picture almost immediately show up in the Dropbox folder.

Clip to Yojimbo Folder with New Items

6.  A couple seconds later, it will import right into Yojimbo.

Succesful File Import into Yojimbo

You’re done.  Pretty cool, right?  You can watch the whole process happen in real time on your Mac if you have the Finder open to the “Clip to Yojimbo” folder alongside an open Yojimbo window.  It is almost instantaneous.  The lack of an iPhone app for Yojimbo was the reason I started using Evernote, so this is pretty exciting.   It probably just swung my decision pendulum back to using Yojimbo.

  • Chris H.
    Sure it's great, but it doesn't do you a darned bit of good for reading existing Yojimbo data on your iphone. Which is what I would want to do 98% of the time.
  • Ken Clark
    Chris, I have been using Evernote on the iPhone and for me, I found that I "clipped" like crazy with the camera, but did most of my sorting out on the Mac, which is why this idea appealed to me. Maybe one way to make Yojimbo data accessible via the iPhone would be to write an Applescript to export Yojimbo data into folders named by tag on Dropbox and then you could view it on the iPhone. I know... that is really over the top, but just thinking out loud as I write this...
  • Sam
    Ken, cool.. yet for non nerds this needs to be baked into one installer. Yes, I'm a nerd yet one that does not have time to deal with scripts.. thanks for your supreme nerdness nonetheless!
  • Ken Clark
    Thanks Sam. I am not sure if it could be automated the whole way through, but I will look into it. --Ken
  • Torch
    I assume that this could also work with other databases, such as DevonThink or FileMaker. Is that true?
  • Torch, I too would be very interested in knowing whether this would work with DEVONthink, which I know is scriptable. However, like Sam, I'm a nerd with insufficient nerding time. Ken, would this work?
  • Ken Clark
    I don't use DevonThink or FileMaker, so I can't answer 100%, but the basic premise is not Yojimbo-specific. What this process is doing is taking a file that was created on the iPhone and then saved to Dropbox in the cloud, and then "acting" on it via a folder action from your local Mac. I would say that as long as DevonThink and FileMaker support importing files via Applescript or Automator actions (and I have to imagine they do), it should work.
  • should do the same for Evernote:

    property done_foldername : "Clip Successful"
    -- if the clip fails, we'll move files into here
    property failed_foldername : "Clip Failed"
    property enNotebook : "noteBox"
    on adding folder items to this_folder after receiving these_items
    try
    -- iterate of files added
    repeat with i from 1 to number of items in these_items
    set this_item to item i of these_items

    set thepath to this_item as text
    set theposix to POSIX path of thepath
    set AppleScript's text item delimiters to "/"
    set theParent to (items 1 thru -2 of text items of theposix) as string
    set AppleScript's text item delimiters to ""
    set keyIndex to the (length of theParent) + 2
    set theName to (items keyIndex thru -1 of text items of theposix) as string
    tell application "Evernote"
    -- clip it!
    create note from file this_item title theName notebook enNotebook
    end tell
    tell application "Finder"
    -- make sure our 'success' destination folder exists
    if not (exists folder done_foldername of this_folder) then
    make new folder at this_folder with properties {name:done_foldername}
    end if
    set done_folder to folder done_foldername of this_folder
    -- move the file we just clipped into our success folder
    move this_item to done_folder with replacing
    -- all done
    end tell
    end repeat
    on error e
    -- uh oh. bad things happened.
    tell application "Finder"
    -- make sure our 'failed' folder exists
    if not (exists folder failed_foldername of this_folder) then
    make new folder at this_folder with properties {name:failed_foldername}
    end if
    set failed_folder to folder failed_foldername of this_folder
    -- move the failed file into the failed folder
    move this_item to failed_folder with replacing
    -- display the error message
    display dialog e buttons {"Cancel"} default button 1 giving up after 120
    end tell
    end try
    end adding folder items to
  • Ken if you don't mind here is a link to how we used dropbox for the iPhone and automater to create folders that will post to Posterous automatically. This was done within hours of the app coming out.

    http://victorcajiao.posterous.com/how-we-upload...
  • Ken Clark
    Very cool. It is pretty similar conceptually to the idea I described above. It is neat to see how all these apps can tie into the Mac's automation tools. I'm a big fan of TMU, thanks for visiting! --Ken
blog comments powered by Disqus

Previous post:

Next post: