• 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: Frontmost Application Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Frontmost Application Problem


  • Subject: Re: Frontmost Application Problem
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 23 Apr 2008 18:24:00 -0700

On Apr 23, 2008, at 1:55 PM, Luther Fuller wrote:

This is a follow-up to Jim Krenz's question "Script to launch or toggle the visibility of an application?"

In one of my script's I replaced, this morning, the line ...

	short name of (info for (path to frontmost application)) as text

with the line ...

tell application "System Events" to (name of (some process whose frontmost is true)) as text

The first line always returns, correctly, the name of the application which appears at the left of the menu bar. The second line, under the right conditions, will return the name of my application. But this isn't supposed to happen, since my application is an FBA and its name never appears in the menu bar. ... The 'activate me' command does not cause my application to appear in the menu bar or dock, so line 2 should NOT return the name of my application ... but it does. If you use this in a script compiled to an FBA, you should make it the first line, something like this ...

tell application "System Events" to set currentAppl to (name of (some process whose frontmost is true)) as text

I haven't the slightest idea if there is a bug here. Perhaps someone knows.

1. I'm betting you're using Tiger. Am I right?

2. Exactly how did you mark your application as "faceless"? Did you use LSUIElement = true, or LSBackgroundOnly = true? There are differences.

If you made your application a UIElement, then it does actually have a "layer" in the UI, and can be activated even though you don't see the menu bar change, so in some sense System Events returning it as "frontmost" is correct. (System Events itself is a UIElement application.) However, no one expects this -- the frontmost application is the one with the menu bar, right? -- so we fixed it in Leopard. "path to frontmost application" returns the menu-bar- frontmost application in both Tiger and Leopard.


--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:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Frontmost Application Problem
      • From: Philip Aker <email@hidden>
    • Re: Frontmost Application Problem
      • From: Luther Fuller <email@hidden>
References: 
 >Frontmost Application Problem (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Direct networking and phantom volumes (Volume-1)
  • Next by Date: Re: Apple Script to make an alias
  • Previous by thread: Frontmost Application Problem
  • Next by thread: Re: Frontmost Application Problem
  • Index(es):
    • Date
    • Thread