2Do Hook to New

Now you can create new tasks in 2Do that are Hooked!

set encodedTitle to do shell script "python -c \"import urllib, sys; print (urllib.quote(sys.argv[1]))\" " & quoted form of "$title"
set encodedTag to do shell script "python -c \"import urllib, sys; print (urllib.quote(sys.argv[1]))\" " & quoted form of "from:Hook"
set linkToParent to "$user_link"

set xCallbackUrl to "twodo://x-callback-url/add?task=" & encodedTitle & "&type=0&tags=" & encodedTag & "&action=url:" & linkToParent & "&saveInClipboard=1&edit=1"

-- presere clipboard as 2Do will put the UID there
set originalClipboard to the clipboard
set the clipboard to ""
open location xCallbackUrl
delay 0.2
set theUID to the clipboard
set the clipboard to originalClipboard

return "twodo://x-callback-url/showTask?uid=" & theUID
1 Like

Super! I’ve added a link to it from the 2Do entry of the linkable apps page.

1 Like

I think $user_link is undocumented — is it OK to use it?

Unless it’s intentional it would be really useful to have the usable placeholders documented.

Yes, you can use $user_link. It is the url of the document.

Also, we will document it in our help pages.

1 Like