• 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: check a process
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: check a process


  • Subject: Re: check a process
  • From: Joshua See <email@hidden>
  • Date: Tue, 23 Dec 2003 17:14:35 -0600

On Tuesday, December 23, 2003, at 03:45 AM, Nigel Smith wrote:
On 18/12/03 12:25, "Jim Brandt" <email@hidden> wrote:
Specifically, I want to know if the Classic environment is running
before I try to launch a OS9 application.
If you know a particular process always runs in Classic, you could test for
that. For example, my Classic has the Suitcase extension installed so I can
do:
tell application "System Events"
if (name of every process as text) contains "Suitcase 9" then
return true
else
return false
end if
end tell
Uglier syntax but more functionality can be had with:

tell application "System Events" to "Classic Support" is in name of [NOBREAK]
every process returning oldCoke

if oldCoke then
-- launch OS 9 application
end if

The above doesn't depend on you knowing if a certain classic app is installed or running, and can point you towards a rich career in obfuscating AppleScript.

There's probably a gestalt code for checking Classic that I'm forgetting, which would be much more efficient.

Otherwise you could use the shell -- note that the first "grep" finds all
matches in the ps listing, possibly including the "grep" command itself, so
the second "grep" omits all "grep" commands...
Possibly in the case means always. You'll get a third hit if you do this from AS since do shell script spawns another process that ps can see.

if (do shell script "ps -auxww | grep TruBlueEnvironment | grep -v
grep") = "" then
return false
else
return true
end if
I don't recommend do shell script because pure AS works, but this will avoid the autogrep problem:

if (do shell script "ps -auxww | grep \\[T]ruBlueEnvironment") = "" then
--
Sincerely,
Joshua See
_______________________________________________
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.

References: 
 >Re: check a process (From: Nigel Smith <email@hidden>)

  • Prev by Date: Re: perl scripting in AppleScript
  • Next by Date: Re: Rename File from Filemaker Pro
  • Previous by thread: Re: check a process
  • Next by thread: Re: check a process
  • Index(es):
    • Date
    • Thread