View Single Post
Quote:
Originally Posted by Noel Roy View Post
I would second that I would really like a script that would read a text file and add an item from each line.

I use a script right now where I select each line and send it to LaunchBar. Launchbar makes a task in omni, and it accepts this form: task >project @context

If there were a way to put each line into this script... or each line within a certain marker? I'm not a programmer, it seems like an easy task, but I don't know.
There are probably a number of variants out there, but something roughly like this would be one simple approach (for selecting several lines and using LaunchBar 'Instant Send' (dbl option tap, for example) to process them in one batch, making each line into a separate task).

Code:
-- LaunchBar script for parsing several lines of selected text to several tasks

on handle_string(str)
	tell application id "OFOC"
		if str ≠ "" then
			-- PARSE TASKS
			set lstParas to paragraphs of str
			tell default document
				repeat with oLine in lstParas
					parse tasks with transport text oLine
				end repeat
			end tell
			
			-- AND REPORT SUCCESS WITH A GROWL NOTIFICATION IF GROWL IS RUNNING
			my Growlify("Create OF Tasks from text", "OF Tasks created", ¬
				((count of lstParas) as string) & " tasks created in OmniFocus:" & return & return & str)
		end if
	end tell
end handle_string


on Growlify(strApp, strNote, strMsg)
	tell application id "sevs"
		if (count of (processes where bundle identifier is "com.Growl.GrowlHelperApp")) > 0 then
			tell application id "com.Growl.GrowlHelperApp"
				register as application strApp all notifications {strNote} ¬
					default notifications {strNote} ¬
					icon of application "OmniFocus"
				
				notify with name strNote title strNote ¬
					description strMsg application name strApp
			end tell
		end if
	end tell
end Growlify

Last edited by RobTrew; 2012-07-07 at 11:51 PM.. Reason: 'dbl opt click' --> dbl opt *tap* (for instant send)