Re: Activating applet or app?
Re: Activating applet or app?
- Subject: Re: Activating applet or app?
- From: Kai Edwards <email@hidden>
- Date: Tue, 09 Apr 2002 04:48:20 +0000
on Mon, 08 Apr 2002 15:26:30 -0700, Paul Berkowitz <email@hidden>
wrote:
>
I'm most accustomed to writing scripts for applications (Entourage and
>
Outlook Express) which run them as compiled scripts from their Scripts menu
>
and which are designed not to allow user interaction (interference) of any
>
type via clicks or menu items while a script is running.
>
>
I'm writing a dew scripts now for an app (Excel) which doesn't have a Script
>
menu, so the scripts will be applets. Naturally, when the script has to open
>
display dialogs, either the applet has to activate, or it will activate
>
Excel and set the display dialog within the Excel block.
>
>
Does anyone have any opinions on which is better? And for that matter,
>
whether it also makes a difference while the script is doing other things
>
such as text and file manipulations, some of which might go on for a bit.
>
Given that the applet will be double-clicked in the Finder, and occasionally
>
the display dialog questions refer to things in an Excel Worksheet which
>
probably should be visible at the time, I can see the advantage of
>
activating Excel. But that might get the user clicking away in Excel before
>
the script has finished - probably not a good idea. So I was thinking that
>
maybe I should activate Excel for an instant to put it in front of the
>
Finder and other apps, then re-activate the applet for the rest of its run.
>
Or will Excel's own events go faster with Excel in the front? And, if so,
>
does that apply only to OS 9 and not X?
>
>
I'd appreciate hearing from anyone with experience here. Thanks in advance.
I've carried out a few tests on this myself, Paul (although my experience
here is limited to pre-X).
In terms of performance, Excel seems to be one of those apps that generally
prefers to be active when performing 'native' operations. The speed
differences will obviously vary depending on what's being done - but the
improvements are usually fairly consistent (if not always substantial).
That said, activating Excel appears to slow down standard AppleScript
routines. So, if these are likely to be significant, it may be worth
considering re-activating the applet to execute them.
However, as you'll be aware, the trouble with frequent switching is that
there's also a speed penalty every time another app is activated (which can
sometimes negate any benefits gained from the switch).
Which means of course that getting the best performance will depend largely
on what needs to be done. (Helpful as ever!) ;-)
FWIW, my personal preference (unless I'm merely grabbing some initial Excel
data) is to activate Excel - so that the user can refer to any relevant data
on the active sheet. To discourage any user 'interference', I occasionally
update the display to indicate that something's still going on - using
commands like:
set StatusBar to "Performing operation x..."
set ActiveWindow's ScrollColumn to y
set ActiveWindow's ScrollRow to z
Select Range "R58C9:R71C14" -- (the range currently being operated upon)
Sorry about all the 'ifs' and 'buts'.
HTH
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.