OO3 & Applescript

James Moore jam at omnigroup.com
Tue Nov 30 11:31:35 PST 2004


On Nov 30, 2004, at 10:16 AM, Timothy J.Wood wrote:

>
>
>   The issue is that the AppleScript support in OmniOutliner 3 now 
> supports multiple selection.  For example you could do:
>
> tell app "OmniOutliner Professional"
> 	tell document 1
> 		get id of every selected row -- all the IDs
> 		get id of first selected row -- this should be what OO2 would have 
> given you
> 	end
> end
>
>   Additionally, since the selection scripting support is 'to many', 
> instead of being able to set the selected row/column, you do:
>
>
> 	add SomeRow to selected rows  -- add to the selection
> 	remove OtherRow from selected rows -- remove from the selection
> 	select {Row1,Row2} -- replace the selection with the listed stuff 
> (which should be all rows or all columns)
>
>   This lets you do fun stuff like:
>
> tell front document of application "OmniOutliner Professional"
> 	select every row whose state is checked
> end tell
>
>   or something like:
>
> -- Moves the selection down a level.  If a row doesn't have children, 
> that row stays selected
> -- Beeps if no change would be made to the selection (no available 
> children or selection was empty to start)
> tell front document of application "OmniOutliner Professional"
> 	set CurrentSelection to selected rows
> 	
> 	set NewSelection to {}
> 	set DidChangeSelection to false
> 	repeat with SelectedRow in CurrentSelection
> 		set RowsChildren to children of SelectedRow
> 		if (count of RowsChildren) > 0 then
> 			set NewSelection to NewSelection & RowsChildren
> 			set DidChangeSelection to true
> 		else
> 			set NewSelection to NewSelection & {SelectedRow}
> 		end if
> 	end repeat
> 	
> 	if DidChangeSelection is false then
> 		beep
> 	else
> 		select NewSelection
> 	end if
> end tell
>
>
>
>> Begin forwarded message:
>>
>>> From: Jan Erik Moström <lists at mostrom.pp.se>
>>> Date: November 30, 2004 4:08:14 AM PST
>>> To: omnioutliner-users at omnigroup.com
>>> Subject: OO3 & Applescript
>>>
>>> I'm trying to get a reference to the currently selected row in OO3 
>>> Pro but
>>> for some reason I can't get the syntax correct:
>>>
>>> tell application "OmniOutliner Professional"
>>>     tell document 1
>>>         get id of the selected row
>>>     end tell
>>> end tell
>>>
>>> This doesn't work, does anyone know how it should look like?
>>>
>>>                 jem
>>> PS
>>> And yes, OO3 is nice and OO3 Pro is even better
>>> DS
>>> -- 
>>> Jan Erik Moström   www.mostrom.pp.se
>>> _______________________________________________
>>> OmniOutliner-Users mailing list
>>> OmniOutliner-Users at omnigroup.com
>>> http://www.omnigroup.com/mailman/listinfo/omnioutliner-users
>>>
>>




More information about the OmniOutliner-Users mailing list