AppleScript questions
Timothy J. Wood
tjw at omnigroup.com
Fri Aug 22 10:13:26 PDT 2003
On Friday, August 22, 2003, at 08:25 AM, Nicholas Riley wrote:
> - In the first case where the topic is empty, the topic doesn't appear
> until I manually move somewhere else in the outline.
This is a known bug that I've got a test case written up for and it
will be fixed in a future release.
The issue seems to be that if you are editing a cell and set the
value of that cell via AppleScript, then the display isn't updated
correctly. Thus, a workaround would be to make sure that you aren't
editing the cell.
In your script you could do:
set theRow to selected row
set selected row to theRow
That is, reset the selected row, thus ending the editing in the cell.
This is a silly (but effective!) workaround and this is definitely on
the list of things to get fixed.
> - In the second case, I'm not able to create a row below the current
> row. I tried "make new row after theRow" but that didn't work; I got
> one of those completely useless Cocoa script error messages. The
> object specifier for theRow seems to contain the information I need,
> specifying what child # it is, but 'index of theRow' doesn't give me
> anything useful and I can't figure out another way to dissect it.
I'm still an AppleScript novice, so someone else may have a better
answer than I do :)
But, looking at my 'Nutshell' book, it says that 'after' is a
relative reference form that requires object references on both sides
of it (ex: "folder after folder "Apple Extras" of startup disk").
'after' isn't well defined here in a creation context -- if you say
'row after row', do you mean to insert as a sibling (same indention
level) or a uncle (sibling of your parent). If you are inserting after
a row in the middle of a level (i.e., the second of three children),
then clearly a sibling makes sense. But, if it is the last child, then
it isn't as clear (although I guess sibling makes most sense to me as I
think about it :)
I've tried a bunch of various test cases, but haven't been able to
get anything obvious to work with 'after' either. I'm not sure if this
is a problem with OO or Cocoa Scripting in general. I'll keep working
on it :)
If I run the script you've given, as written on a new document (with
my 'end editing hack' from above), then the first time I run it it sets
the date. The second time I get an error trying to get the parent of
the selected row. I'm not exactly sure what effect you are trying to
achieve, so I'm not sure what the best fix is :)
> - The font of any script-set topic is Helvetica. As much as I like
> Helvetica, I would prefer that the items follow the standard styles of
> the outline (how I wish for the flexibility of MORE's rules, but
> that's another rant :) The only workaround I can think of is to use UI
> Scripting to pick the 'copy style' and 'paste style' commands from
> menus, but there has to be a better way...
There are certainly a few styles you can apply manually:
bold topic of theRow
italicize topic of theRow
underline topic of theRow
set alignment of topic of theRow to right
set color of topic of theRow to {65535, 0, 0} as RGB color
set size of topic of theRow to 64
set font of topic of theRow to "Courier"
But, yes, it would be much nicer if the row defaulted to using the
level styles defined in the document. I'll add some test cases for
this and add it to the list of stuff to get fixed.
-tim
More information about the OmniOutliner-Users
mailing list