Applescript help

Michael Terry formido at mac.com
Sun Apr 17 17:40:07 PDT 2005


On Apr 15, 2005, at 6:39 AM, Adam Wuellner wrote:

> On 4/15/05, Curtis Clifton <curt.clifton at mac.com> wrote:
>> On Apr 15, 2005, at 4:11 AM, AntToeKnee.9604432 at bloglines.com wrote:
>>
>>>  I'm trying to delete the selected row in an outline, using;
>>>
>>> tell front
>>> document of application "OmniOutliner Professional"
>>>   delete selected row
>>>
>>> end tell
>>>
>>> But nothing happens.
>>
>> The property "selected row" needs some sort of index since 
>> multiple-row
>> selections are allowed.  So you want something like "delete selected
>> row 1" or "delete selected rows".  Unfortunately, neither of those 
>> seem
>> to work either.  The following worked:
>>
>> set theRow to selected row 1
>> delete theRow
>>
>> The need to use two separate AppleEvents for this seems like an OO3 
>> bug.
>
> If it is, it's one shared by _many_ an application.
> This works, too:
> 	delete (get selected row 1)
>
> Throwing in an apparently superfluous 'get' fixes a lot of AS code,
> throughout the Mac application space, that otherwise looks like it
> should work.  It's still two Apple Events, though.
>

Shared by many applications, true, but surely a bug. In many 
applications exhibiting this behavior, it's not even consistent: For 
some operations the 'get' is implied, but in others it's not. It can 
and should be addressed by any developer that can fit it in, since a) 
It confuses novices no end, and b) Fixing it makes for faster scripts. 
The command above should only take one Apple event, e.g., compare AE 
output in Script Editor for, say, 'tell app "Finder" to delete first 
file of (choose folder)' vs 'tell app "Finder" to delete (get first 
file of (choose folder))'. Not critical for scripts working on the 
selection, but in many others.

Michael




More information about the OmniOutliner-Users mailing list