Problems with OO and Applescript

Michael Terry formido at mac.com
Wed Mar 3 12:12:56 PST 2004


On Mar 3, 2004, at 11:45 AM, Ben Bornstein wrote:

>      I'm new to both OmniOutliner and Applescript (though I am a 
> professional developer comfortable with many programming languages).  
> I wrote a simple Applescript to do some calculations across columns in 
> a row and store the result in another column in that same row.  I've 
> run into two problems:
>
>        1. The script runs fine when I run it from either the Script 
> Editor
>           (by pushing the 'Run' (Play) button) or the Finder 
> AppleScript
>           menu.  However, I can't seem to run it from the 'Scripts' 
> menu
>           within OO.
>
>           Am I missing something obvious?  Does anyone have any 
> suggestions?

You aren't missing anything obvious at all. It's a file format 
incompatibility between OO and SE 2. You can fix it by changing the 
script to a resource fork type rather than a data fork type. Two ways 
offhand: Download the free script editor called Smile from Satimage 
software or see man 'osacompile'. There have been a couple threads in 
the archives within the last several months which you can probably find 
if you have any trouble.

>
>        2.  My script only updates cells in rows without children (via 
> 'set
>            value of cell [column num] of [row reference] to ...'), 
> though a
>            row may have a parent.  Unfortunately, for 'calculated 
> summary'
>            columns, OO doesn't update the summary information in the
>            parent row.  Does this make sense?
>
>            Am I doing something wrong?  Is there a command I can send 
> to OO
>            to trigger the parent summary cell to update?  Or is this a 
> known
>            bug / issue in OO?  If not, I can post a short example 
> script that
>            reproduces the problem (this message is long enough 
> already).

I don't have time to look at this right this second, but it's probably 
a bug. You should report it.

>      Finally, (maybe this is already possible?) it would be great if I 
> could trap or listen to OO events to immediately update a calculated 
> cell after another one has been edited.  Again, I'm new to 
> Applescript, so I'm not sure if there's a notion of an 'always on' 
> script to handle events or some sort of event handler registration 
> mechanism.  Could someone enlighten me?
>

This is possible with AppleScript. Some applications have event 
handlers which you can attach scripts to. Finder's folder actions are 
an example. AIM also has them. I've made feature requests for this in 
the past. If it seems like a good idea to you, too, it would help if 
you'd request it, also. A workaround is to look into using 
AppleScript's built-in idle handler. Unfortunately, it only works with 
applets, but that might seem like a problem to you.


Mike




More information about the OmniOutliner-Users mailing list