Re: No way to tell if an application is running without launching it?
Re: No way to tell if an application is running without launching it?
- Subject: Re: No way to tell if an application is running without launching it?
- From: Christopher Nebel <email@hidden>
- Date: Wed, 6 Oct 2004 17:11:25 -0700
On Oct 5, 2004, at 3:40 PM, Bill Planey wrote:
On 10/5/04 3:01 PM, "Christopher Nebel" <email@hidden> wrote:
On Oct 5, 2004, at 9:14 AM, Nigel Smith wrote:
On 5/10/04 13:12, "Bill Planey" <email@hidden> wrote:
I have a script that checks if an application is running, then
quits it if it finds that it _is_ running. The problem is - the
mere fact that applescript checks for this application process is
enough to launch it (and
then, of course, the script quits it). Just the act of checking
seems to be enough to launch it if it isn't running at the time?
Are you sure that is what is happening?
Distiller will launch when you try to *compile* the script, and if
you save it as a script document rather than an application it will
have to be recompiled each time you open it -- that will launch
Distiller.
Script documents are compiled scripts. You're thinking of plain text.
Actually, the script is saved within and called from FileMaker Pro
v.7, if
that makes a difference.
Maybe -- if FMP7 saves the script as plain text and compiles it on the
fly, then that would trigger the behavior you're seeing. The problem
is that as soon as AppleScript sees 'tell application "Distiller"' when
compiling, it tries to get Distiller's dictionary. If Distiller claims
to have dynamic terminology, then it has to be launched. You can get
around this by breaking up the application reference so AppleScript
can't resolve it at compile time, something like this:
set d to "Distiller"
tell application d to quit
Since "quit" is a standard command, not having the full dictionary
doesn't matter. (If you were using Distiller-specific commands, this
stunt wouldn't work.)
Also, as of 10.3, telling a non-running application to quit won't
launch it (and then quit it), so the two-liner above should be all you
need.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden