• 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
Getting the Frontmost Process's Name from the Script Menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting the Frontmost Process's Name from the Script Menu


  • Subject: Getting the Frontmost Process's Name from the Script Menu
  • From: "Jonathan Levi, M.D." <email@hidden>
  • Date: Sun, 26 Aug 2007 01:42:43 -0400

Please excuse a newbie-oid question: How to write an AppleScript that will get the frontmost process's name when run from the Script Menu? For instance,

tell application "System Events" to set frontProcNameList to (name of application processes whose frontmost is true)
set frontProcName to item 1 of frontProcNameList
tell application frontProcName to display dialog frontProcName


gives Script Editor if run as a script, but System Events when run from the Script Menu, regardless of what application appears to be active (name showing in upper left corner of screen, gets keystrokes, etc.) If the same script is saved as an application and run from the Script Menu, it gives its own name, even if it appears to be in the background. (Doing the same thing with the Finder instead of System Events makes no difference.) Any help?

Thanks,

Jonathan
_______________________________________________
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: Getting the Frontmost Process's Name from the Script Menu
      • From: Luther Fuller <email@hidden>
    • Re: Getting the Frontmost Process's Name from the Script Menu
      • From: Philip Aker <email@hidden>
  • Prev by Date: palette creation...
  • Next by Date: Re: Opening documents in App via Finder?
  • Previous by thread: Re: palette creation...
  • Next by thread: Re: Getting the Frontmost Process's Name from the Script Menu
  • Index(es):
    • Date
    • Thread