• 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: Process whose frontmost *was* true?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Process whose frontmost *was* true?


  • Subject: Re: Process whose frontmost *was* true?
  • From: Graff <email@hidden>
  • Date: Thu, 27 May 2004 12:47:46 -0400

Under Mac OS X the Finder actually calls System Events to do just this. You can shorten the script to just:

Finder version:
----
tell application "Finder"
set frontProcess to every process whose frontmost is true
end tell
----

System Events version:
----
tell application "System Events"
set frontProcess to every process whose frontmost is true
end tell
----

Both scripts work the same and they eliminate the need for a repeat statement.

- Ken

On May 27, 2004, at 10:48 AM, David Durkee wrote:

You might try using a different triggering program. I tried this script:

tell application "System Events"
set apps to application processes
repeat with anapp in apps
if frontmost of anapp is true then
set aname to name of anapp
display dialog aname
exit repeat
end if
end repeat
end tell

Executed from iKey, it currently displayed whatever was in front at the time I pressed the key. There might be a reason why Key Xing is discontinued.

David

On May 24, 2004, at 12:02 AM, Jeff Porten wrote:

First, apologies. I'm sure I've seen this discussed before, but I can't find it in a fulltext search of AS-Users, or in Google efforts. If my answer is easily found by a search I forgot to try, consider the wet noodle already applied in 30 lashes.

I have an AppleScript that I'm calling with a keystroke (via Key Xing, a discontinued SysPrefs hot-key app), and which I want to branch into different functions depending on what application is frontmost. Testing works fine by manually activating an app, and telling System Events to return the process whose frontmost is true.

But when I run the script in real usage, the frontmost app is Key Xing Listener. And I don't see a secondmost boolean.... I've tried telling Key Xing Listener to hide, but since it's faceless, no dice. I've also tried a delay (on the theory that the Listener just needed a second to get out of the way), but further lack of dice resulted.

My rummage through AS-Users found a command to tell the Finder to return a frontmost, which looked promising until it always returned "Finder".

My gut says I'm complexifying this -- what am I missing?
_______________________________________________
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.


  • Follow-Ups:
    • Re: Process whose frontmost *was* true?
      • From: Joseph Weaks <email@hidden>
References: 
 >Process whose frontmost *was* true? (From: Jeff Porten <email@hidden>)
 >Re: Process whose frontmost *was* true? (From: David Durkee <email@hidden>)

  • Prev by Date: Address Book scripting bug
  • Next by Date: Re: Folder Actions: specific complaints please
  • Previous by thread: Re: Process whose frontmost *was* true?
  • Next by thread: Re: Process whose frontmost *was* true?
  • Index(es):
    • Date
    • Thread