Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Created October 22, 2012 14:16
Show Gist options
  • Save ttscoff/3931703 to your computer and use it in GitHub Desktop.
Save ttscoff/3931703 to your computer and use it in GitHub Desktop.
Ruby function to find the first TaskPaper project matching a title fragment
def first_matching_project(fragment)
%x{osascript <<'APPLESCRIPT'
tell application "TaskPaper"
tell front document
set projectlist to name of projects
set frag to "#{fragment}"
repeat with aproject in projectlist
if (offset of "#{fragment}" in aproject) > 0 then return (aproject as string)
end repeat
return "Inbox"
end tell
end tell
APPLESCRIPT}.strip
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment