Applescript help

Curtis Clifton curt.clifton at mchsi.com
Fri Nov 21 16:15:11 PST 2003


Jon,

On Nov 21, 2003, at 4:33 PM, Jon Muller wrote:

> Ok.  So my proposed solution was to create a new column to the left of 
> the paragraphs and fill it with check-off boxes.  There is no 
> parent-child link to these boxes so I am free to check whatever I 
> want.  The new column is titled "Print".
>
> The problem is that I know virtually nothing about Applescript and do 
> not know how modify the above script to look at the checkboxes in the 
> Print column, instead of the "state" checkboxes.  Any of you 
> Applescript whizzes out there know if this can be done and what should 
> be added to make it work?

I think the following script, which I use to delete items that I do not 
need from a packing list, might do the trick:

-- Deletes unneeded items from a packing or shopping list
-- by Curtis Clifton
-- Copyright (c) 2003, All Rights Reserved

property needColumnNumber : -1

-- Start of main script
tell front document of application "OmniOutliner"
	-- First find "Need" column
	set colCount to count of columns
	repeat with colIndex from 1 to colCount
		if title of column colIndex is "Need" then
			set needColumnNumber to colIndex as integer
			exit repeat
		end if
	end repeat
	if needColumnNumber is -1 then
		display dialog "Unable to delete unneeded items because no column 
named \"Need\" was found" buttons {"OK"} default button "OK" with icon 
stop
	else
		set r to display dialog "Do you really want to delete all unneeded 
items from the list?" buttons {"No", "Yes"} default button "No" with 
icon caution
		if (button returned of r) is "Yes" then
			-- Need to loop because the first iteration might result in new, 
unneeded leaf nodes (as all
			-- the children were deleted)
			repeat until (count of (every row whose (value of cell 
needColumnNumber is 0) and has subtopics of it is false)) is 0
				delete (every row whose (value of cell needColumnNumber is 0) and 
has subtopics of it is false)
			end repeat
		end if
	end if
end tell

Note:

1. My additional column with checkboxes is named "Need".  If you want 
yours to be called "Print" then edit the script accordingly.
2. My additional column uses calculated summaries for parent 
checkboxes.  I think it will work with no summaries, but I haven't 
tested.

Use at your own risk.  This script deletes stuff! :-)

Hope this helps,

-- Curt

** Integrate OmniOutliner on your Mac with ShadowPlan on your Palm OS 
device. **
http://www.cs.iastate.edu/~cclifton/software.shtml




More information about the OmniOutliner-Users mailing list