The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniPlan > OmniPlan General
FAQ Members List Calendar Today's Posts

 
How to update OP completion percentage from reading a text file Thread Tools Search this Thread Display Modes
Is there a way to update completion percentage of a task from reading a text file ?
i.e. short of collaboration, is there a way to update existing OP plans from reading a text file ?
 
Yeah, you just have to come to the forum and ask and someone will write a script for you :-)

The following script will prompt you for a text file containing lines like this:

1 0.5
3 0.7
93 0.15

where the first number is the Unique ID value for the row and the second number is the fraction of completion (0.0 for not started, 0.5 for 50%, 1.0 for 100%, etc.) Both Unique ID and Completion can be turned on as columns in the outline via the View->View Options... command.

After reading the file, the script will attempt to set the completion fraction of the designated actions. Any rows that don't exist, or where an error is encountered, will be reported and skipped over.

I would recommend running this on a copy of your data file until you are convinced of proper operation. If you need help installing the script, check out this thread:

http://forums.omnigroup.com/showthread.php?t=7453

(the procedures are the same, just read OmniPlan where you see OmniFocus)
Code:
tell application "OmniPlan"
	try
		set fileContents to read (choose file with prompt "Choose text file containing completion data")
	on error
		display dialog "Couldn't read file" buttons "OK"
		return
	end try
	
	-- file format is lines of (int)unique_id (float)completion_fraction
	
	set listofData to every paragraph of fileContents
	
	repeat with parseRow in listofData
		if (length of parseRow > 0) then
			try
				set {Unique_id, Completion_fraction} to words of parseRow
				set myTasklst to (tasks of front document whose id is Unique_id)
				set myTask to first item of myTasklst
				set completed of myTask to Completion_fraction
			on error
				display dialog "Couldn't understand following row, ignoring it:
" & parseRow buttons "OK"
			end try
		end if
	end repeat
end tell
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
iPhone backup to text file? linabella OmniFocus for iPhone 2 2011-09-13 12:41 PM
Export to text file CLUTTER charismatic OmniFocus 1 for Mac 2 2010-01-08 01:41 PM
applescript to export to text file? jbaile38 OmniFocus Extras 3 2008-09-06 12:01 PM
omnifocus perspectives view into a text file msim OmniFocus Extras 7 2008-03-31 02:26 PM
Applescript example: exporting to a text file RobTrew OmniFocus Extras 6 2007-09-11 08:27 PM


All times are GMT -8. The time now is 10:47 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.