Re: Activating applet or app?
Re: Activating applet or app?
- Subject: Re: Activating applet or app?
- From: Kai Edwards <email@hidden>
- Date: Wed, 10 Apr 2002 04:15:36 +0000
on Mon, 08 Apr 2002 22:13:55 -0700, Paul Berkowitz <email@hidden>
wrote:
>
Thanks, Kai, and Shane. Yes, I came to the same conclusion. In X, the
>
dialogs are that tiny bit faster to appear when the applet is active, but
>
who notices that? The main "meat" of the script goes faster with Excel in
>
front. and - as you and Shane say - the worst is switching back and forth.
Agreed, Paul. As Shane rightly pointed out, an app like FileMaker Pro
generally works decidedly faster in the background. Excel, however, seems to
be a rather different animal - generally achieving more impressive speeds
when activated.
>
i think that any slowdown in native AppleScript business which you see is
>
related to being in an application tell block - not whether the applet is in
>
the front or not. The slowdown relates having to send the commands via an
>
app. Having activated Excel, it stays there even while a section of the
>
script is taken out of the tell block. This seems to be the best of both
>
worlds.
I got some interesting results when I last compared the times taken to
perform a basic AS routine in four different ways. (I'll post them
separately to avoid making this note too fat!) 8-P
>
...Excel really takes the cake - just about the whole thing is undocumented.
>
Or is there anything other than that musty guide to Excel 4 at large on the
>
net?
If there is, I wish someone would tell us about it. Most of what I've
gathered to date has been from trial and error (mainly the latter)! ;-)
>
I just discovered today the trick of prefixing a single quote ' to get a
>
date to be entered as string rather than as date format (where every user
>
will have a different format). Getting the Value by AS or exporting as Text
>
file in the UI removes the ', which isn't visible in the Worksheet either
>
unless you double-click the cell.
Yeah. The trick also works for times - as well as other numbers that one
might wish to treat as text (to sort alphabetically, for example). Since the
' isn't visible, the only clue that a value is formatted as a string is
Excel's default (left) alignment for text. However, as you've no doubt also
discovered, you can still access the numeric values for calculations.
>
And setting a blank cell by "" even though
>
getting the Value is 0. Is there anywhere to read up on all this stuff?
That nearly caught me out in an early script. I had to resort to a basic
check, something like this (the dialogs are just for demo):
------------------------------------------
tell application "Microsoft Excel"
set val to ActiveCell's Value
if val = 0 and val's class is integer then
display dialog "The cell is empty."
else
display dialog "The cell contains " & val & "."
end if
end tell
------------------------------------------
>
As another example, how would you ever know from the AS Dictionary what the
>
FieldInfo property of TextOpen wants: list of integer -- a list of tuples.
>
Tuples?? Reading up on the same Method in the VB Editor explains what's
>
going on. But there's no VB equivalent to knowing that you can set the Value
>
of a whole column by a list of lists of strings. That's AS -only. Someone
>
sometime went a great deal of trouble to implement all this, but no one
>
wrote it up. (What about needing "!" to make Evaluate work with a saved
>
macro? Jeez!) The AppleScript implementation actually seems pretty good,
>
once you accept the upper-case initial characters, but is it documented
>
anywhere?
I couldn't agree more. Having previously relied more on macros to automate
tasks, I've been really impressed with the scope of AS within Excel.
FileMaker Pro's 'Apple Events Reference' (actually a FileMaker database) is
often cited as an example of good documentation because of its comprehensive
coverage and healthy sprinkling of examples.
Even one of Microsoft's free applications, Outlook Express, contains some
excellent AS documentation in the form of the 'AppleScript Reference for
Outlook Express'.
And yet Excel, which clearly has a wealth of AppleScript machinery under the
hood, seems curiously shackled - purely by the apparent lack of explanatory
material. As you say, all the technical work's already been done. Surely
Microsoft can't have overlooked such a simple way to exploit this key
application's potential even further? :-)
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.