Send a document (or link to a document) to 2do app

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I use the 2do app on OSX for reminders, and have been trying to create a script in Hazel to create a reminder. I'm a novice at scripting, but as I understand it 2do does not have Applescript support but does have a URL scheme ( http://2doapp.com/kb/article/url-schemes.html)

After a few searches of similar scenarios I came up with the following shell script:

Code: Select all
do shell script "open 'twodo://x-callback-url/add?task=Claim reimbursement" & "&Note=" & theFile & "'"


I don't really understand how it works but it does, creating a new 2do item in the Inbox, with the file name and path as a note. However it has limited usefulness as there is no link to that document, which is what I'd really like to add.

Could anyone provide any guidance on how I might make this more useful by adding a link to the file instead of just its name and path?
djb21au
 
Posts: 3
Joined: Wed Jul 13, 2016 10:25 pm

I think you may want to contact the support team for the 2do app. It looks like the details are things that they are responsible for, which is how to make a link and pass that in.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks. I actually worked out a solution combining the instructions in this post here (http://www.noodlesoft.com/forums/viewtopic.php?f=3&t=1770) and a script I found in an Alfred workflow.

In case others are interested, the applescript I'm using in Hazel is below. This creates a new 2do item with a link to the file as an action. Before running the code, Hazel temporarily renames the file with the pattern (FILENAME|FILE PATHNAME):

Code: Select all
tell application "Finder"
   set myHazelTokenDelimiters to "|"
   set theListOfCustomTokens to name of theFile
   set AppleScript's text item delimiters to {myHazelTokenDelimiters}
   -- Now, the tokens are available in theListOfCustomTokens as items 1,2,3 etc...
   
   set taskName to text item 1 of theListOfCustomTokens
   set listName to text item 2 of theListOfCustomTokens
   set urlScheme to "twodo://x-callback-url/add?task=" & taskName & "&action=url:file://" & listName
   tell application "System Events"
      open location urlScheme
   end tell
end tell
djb21au
 
Posts: 3
Joined: Wed Jul 13, 2016 10:25 pm


Return to Support