• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Weird feature of "if it exists" or?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Weird feature of "if it exists" or?
  • Next by Date: summary: Weird feature of "if it exists" or?
  • Previous by thread: Re: Weird feature of "if it exists" or?
  • Next by thread: Re: Weird feature of "if it exists" or?
  • Index(es):
    • Date
    • Thread