Re: Frontmost Application Problem
Re: Frontmost Application Problem
- Subject: Re: Frontmost Application Problem
- From: Luther Fuller <email@hidden>
- Date: Thu, 24 Apr 2008 07:51:47 -0500
Yes, I'm using Tiger. (I'll be using Leopard tomorrow.) My script
compiling script compiles an application bundle with Script Editor,
then sets the value of LSUIElement in the Info.plist file. I do not
use LSBackgroundOnly.
I have just reread the definitions in BPRuntimeConfig.pdf and I'm not
sure, but I don't think I should be using LSBackgroundOnly. My
faceless applications usually need to 'display dialog ...'. Perhaps
you can clarify.
So ... I don't need to worry about this in Leopard!
On Apr 23, 2008, at 8:24 PM, Christopher Nebel wrote:
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