DevonThink Pro has a script Add as To Do to TaskPaper. This works for TaskPaper 2 and not in TaskPaper 3. It adds to the Inbox: in Taskpaper an entry with a link to the relevant entry in DevonThink Pro.
The script is at the end. According to the information when I posted on the DevonThink Pro site, the following line:
set theProject to make new «class TPpr» with properties {name:“Inbox”}
Would be possible to amend the script to make it work with TaskPaper 3. I have not skill/knowledge in AppleScript/JavaScript so cannot fix myself. Any help would be gratefully received.
try
– Get the selection
tell application id “DNtp” to set thisSelection to the selection
– Error handling
if thisSelection is {} then error localized string “Please select a document or group, then try again.”
if (length of thisSelection) > 1 then error localized string “Please select only one document or group, then try again.”
– Get and format the data we need
tell application id “DNtp”
set thisItem to first item of thisSelection
set theSummary to (name of thisItem) as string
set theURL to (reference URL of thisItem) as string
end tell
– Add the tags to the summary, a speciality of Task Paper
set theSummary to (theSummary & " /" & (localized string pTags)) as string
tell application “TaskPaper”
tell front document
try
set theProject to «class TPpr» named “Inbox”
on error err
set theProject to make new «class TPpr» with properties {name:“Inbox”}
end try
tell theProject
set taskEntry to make new «class TPer» with properties {name:"- " & theSummary}
tell taskEntry
make new «class TPtg» with properties {name:pTags}
make new «class TPer» with properties {name:theURL}
end tell
end tell
end tell
end tell
on error errMsg
display alert (localized string “Error when adding item to Task Paper”) message errMsg
Psyched to find this, but it’s not quite working for me — I’m getting an error, “Application can’t be found,” and it’s TP3 the script is failing to find. But I think the reference name is right: “com.hogbaysoftware.TaskPaper3”. Or am I mistaken? I’m running TP 3.6 (v. 283).
Thanks to both you and @GuiB — that indeed did it. Sweet! I’ve used TP since v1, but TP3 is the first to become my main project management app… and the forum’s support certainly helps.
I copied the script exactly into Script Editor - as far as my limited knowledge goes it seems ok. I saved it and placed it in the DEVONthink scripts folder. Clean reboot.
But when I select a file in DEVONthink, and then select the TaskPaper script, DEVONthink just freezes.
I don’t know much about scripts, (have managed a couple which worked ok - one example was DEVONthink to Things), but only very limited actual editing.
I have OS X 10.12.2 and DEVONthink 2.9.8
I wondered if maybe I have some security settings which prevent Javascript from running?
Ideally what I would like is the same capability as the below script, but for TaskPaper instead of Things. (This script works very well, and te idea behind it may appeal to others.
– Script to automatically scan a text file, extract task items and send them to Things
– Written by Luc Beaulieu, Version 1.1, March 12, 2015
– Re-use portions of a script “Add as To Do to Things” written by Eric Böhnisch-Volkmann, Version 1.0.1, Jan 28, 2010
– Set properties
property pTags : "DEVONthink"
property pPrefix : “” – Prefix for the created to do item
try
-- Get the selection
tell application id "DNtp"
set thisSelection to the selection
set theRecord to the first item of (selection as list)
set theType to the type of theRecord
set pType to theType as string
end tell
-- Error handling: do not continue if these occurs
if thisSelection is {} then error localized string "Please select a document, then try again."
if (length of thisSelection) > 1 then error localized string "Please select only one document, then try again."
if pType is equal to "group" then error localized string "Trying to parse a Group/Folder. Select a file, then try again"
-- Now time to get and format the DATA we need
set pLocalizedTags to localized string of pTags
tell application id "DNtp"
set theText to plain text of theRecord
set theLines to paragraphs of theText
set thisItem to first item of thisSelection
set theSummary to (name of thisItem) as string
set theURL to ("[url=x-devonthink-item://" & uuid of thisItem & "]" & name of thisItem & "[/url]") as string
end tell
-- Iterating through each line, one by one, for the string delimeter "ACTION:"
-- and create a new task in Things global Inbox if appropriate
set textDelim to "ACTION:"
set nTask to 0
repeat with eachLine in theLines
set nextLine to eachLine
set finalTask to ""
if nextLine contains textDelim then
set AppleScript's text item delimiters to textDelim
set theTask to item 2 of every text item of nextLine
set AppleScript's text item delimiters to ""
set finalTask to finalTask & theTask
-- set finalTask to finalTask & theTask & return
end if
if finalTask is not equal to "" then
set nTask to nTask + 1
tell application id "Thgs"
-- create task entry in Inbox with a link back to the meeting notes
make new to do with properties {name:finalTask, notes:theURL, tag names:pLocalizedTags}
end tell
end if
end repeat
display dialog (nTask as string) & " were created!"
The script does, in fact work. Occasionally, DEVONthink has a problem with some scripts that are added to its private script folders in Application Support. If you compile the script and add it to ~Library/Scripts/DEVONthink (the global OS X scripts folder for your user account) then you can invoke the script successfully from the OS X scripts menu. Over here I’ve done that and can verify the script operates as expected.
That script written by Luc Beaulieu is very useful if you take notes on an iPad.
He writes his notes in a text file on his iPad, and prefixes any Task items by the term “ACTION:”
Then once copied across to DEVONthink on his Mac, he runs the script on this text file and it automatically scans, extract the task items and sends them as individual tasks to Things.
Would anyone here see the value in copying this script for TaskPaper? I’d love to do it but while having a (very) limited knowledge of AppleScript, I have zero knowledge of Javascript.