Re: Weird feature of "if it exists" or?
Re: Weird feature of "if it exists" or?
- Subject: Re: Weird feature of "if it exists" or?
- From: julifos <email@hidden>
- Date: Sun, 14 Sep 2003 22:54:08 +0200
>
Hi,
>
>
I'm trying to make one of my morning scripts work
>
on more than one machine. The following script
>
doesn't cut it.
>
>
try -- if not installed, don't error
>
if exists application "SETI@home_OSX" then
>
set setiRunning to (processes whose name = "SETI@home_OSX") {}
>
if not setiRunning then
>
tell application "SETI@home_OSX" to activate
>
tell application "System Events" to set
>
visible of process "SETI@home_OSX" to false
>
end if
>
end if
>
end try
>
>
I stops and complains "where is app
>
"SETI@home_OSX"? Is there a way around this
>
"feature"?
>
>
What I'm trying to do is run "SETI@home_OSX" if
>
it exists and ignore it if it doesn't.
>
>
One a related note, I can't even open the script
>
without identifying a bogus "SETI@home_OSX".
>
>
TIA,
>
--
>
Bob Poland - Englewood, CO
I would rewrite this as follow:
###################################
--> does app exist?
try
tell application "Finder" to application file id "ToyS"
on error --> such app doesn't exist
return
end try
--> it exists. is it already running?
tell application "Finder" to name of processes contains "Script Editor"
if not result then --> app exists, but is not running
--> launch or do whatever
end if
###################################
I used the Script Editor for this example, but you should adaptate it for
"SETI@home_OSX", looking for its "creator code" (substitute "ToyS") and
replacing "Script Editor" with "SETI@home_OSX".
jj
_______________________________________________
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.