• 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: Script to launch or toggle the visibility of an application?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script to launch or toggle the visibility of an application?


  • Subject: Re: Script to launch or toggle the visibility of an application?
  • From: Jim Krenz <email@hidden>
  • Date: Wed, 23 Apr 2008 08:33:27 -0700

This works perfectly. And I appreciate the -- comments, as they are helping me understand things better. Thanks again Luther!

Jim

On Apr 23, 2008, at 6:05 AM, Luther Fuller wrote:

Try this, I think it does what you need.

tell application "System Events"
set visible of (some process whose frontmost is true) to false -- Hides this application
-- not necessary if you compile as a Faceless Background Application (FBA)
if not (exists process "Mail") then
tell application "Mail" to activate
else
if not (visible of process "Mail") then
tell application "Mail" to activate
-- Launch the application if it is not already running
else
if frontmost of application "Mail" then
set visible of process "Mail" to false
-- Hide the application if it is frontmost
else
tell application "Mail" to activate
-- Make the application frontmost if it is hidden
end if
end if
end if
end tell


On Apr 23, 2008, at 12:42 AM, Jim Krenz wrote:

Thanks Luther!

So, after using the script you modified, I came to the conclusion that what I was actually wanting to do is:

Launch the application (if it is not already running)
Hide the application if it is the active application
Activate the application (if it is active and hidden)

Your script does the above except that it doesn't activate the application when it is made visible. Any suggestions on how to do so?

Jim

On Apr 21, 2008, at 9:48 AM, Luther Fuller wrote:

I modified this from a recent script ...

	tell application "System Events"
		if not (exists process "ApplicationName") then
			tell application "ApplicationName" to activate
		else
			not (visible of process "ApplicationName")
			set visible of process "ApplicationName" to the result
		end if
	end tell

On Apr 21, 2008, at 10:28 AM, Jim Krenz wrote:

Is there a single script that would:

Launch an application (if it is not running)

-or-

Toggle the application's visibility (if it is already running)?

Thanks in advance for any ideas, pointers, etc.
______________________________________________


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Script to launch or toggle the visibility of an application? (From: Jim Krenz <email@hidden>)
 >Re: Script to launch or toggle the visibility of an application? (From: Luther Fuller <email@hidden>)
 >Re: Script to launch or toggle the visibility of an application? (From: Jim Krenz <email@hidden>)
 >Re: Script to launch or toggle the visibility of an application? (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Automatic stops in a playlist within iTunes
  • Next by Date: Re: How to tell if text is of another language
  • Previous by thread: Re: Script to launch or toggle the visibility of an application?
  • Next by thread: Tiger & Leopard Together
  • Index(es):
    • Date
    • Thread