Applescript help

Curtis Clifton curt.clifton at mac.com
Fri Apr 15 06:24:51 PDT 2005


On Apr 15, 2005, at 4:11 AM, AntToeKnee.9604432 at bloglines.com wrote:

> I'm pretty new to applescript but have a lot of programming experience.

As an experience programmer who then learn AppleScript, knowing how to 
program can sometimes get in the way of learning AppleScript.  It's a 
strange beast, but wonderfully useful.

>  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.

> Also, generally how to I find what applescript bindings are available
> for a particular application?  In the case of Omnioutliner I can find 
> no mention
> of the objects specific to that application.  Surely there must be 
> per-app
> documentation?

The documentation is just that provided by the AppleScript dictionary 
for the application (see File -> Open Dictionary… in Script Editor).  
AppleScript dictionaries are notorious for having inaccuracies.  Often 
trial and error, or googling for example scripts, is the only way to 
sort out what incantation is necessary.  Also, while the object model 
in OO3 is quite nice, the implementation seems to be incomplete.  Many 
commands, like your example, require arcane workarounds.  But even with 
these issues, I've found it fun and productive to use AppleScript to 
automate my workflow in OO3 Pro.

Curt

----------------------------------
Curtis Clifton, PhD Candidate
Dept. of Computer Science, Iowa State University
http://www.cs.iastate.edu/~cclifton




More information about the OmniOutliner-Users mailing list