Re: Applescript brings finder to front each time
Re: Applescript brings finder to front each time
- Subject: Re: Applescript brings finder to front each time
- From: JollyRoger <email@hidden>
- Date: Wed, 06 Jun 2001 08:14:50 -0500
Correct, and take out the tell application "Finder" if it is not needed. If
this is the same script you were working with in the thread "Re: newbie text
manipulation", the commands belong to the Standard Additions scripting
addition - not the Finder.
Remember: when you wrap commands in a tell block, you are telling
AppleScript to send the commands to that application, and to wait for a
response from that application before continuing. There is no need to make
your script wait for a response from an application if the commands you are
using do not belong to that application.
What ends up happening (best case scenario), is the application acts as a
"middle man" and passes the command on to the system where it eventually
gets sent to the scripting addition to which it really belongs. This can
slow your script down, especially if the application is busy when it
receives your command, which is more often the case with a central
application like the Finder.
The worst case scenario is that the application you tell mistakenly attempts
to handle or partially handle the command, even though the command does not
belong to the application, resulting in an error or the incorrect response.
This can be very hard to debug when it happens. In a perfect world, this
should never happen; but not all applications are written well.
You can save yourself headaches by being sure to only wrap your code in a
tell block when necessary.
HTH
JR
On 6/5/2001 9:19 PM, "email@hidden" <email@hidden> wrote:
>
I guess I answered that one myself. Don't put the word activate after "tell
>
application "Finder" and it won't bring the finder to the front, at least in
>
my applescript. If you can launch an applescript from a control panel, such
>
as ido script scheduler, then the finder need not come to the front to
>
activate the script. This was probably elementary to you veteran
>
applescripters.
>
>
In a message dated 6/5/01 4:34:11 PM, RHD101 writes:
>
>
> When an applescript is launched, must it always bring the finder to the
>
> front, or can it open in the background without the finder being brought
>
> to the front? If not, is there a way to know which application was in front
>
> and then bring that application back to the front when the applescript
>
> is finished. Thanks.
>
>
>
> John