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

Re: Getting the Frontmost Process's Name from the Script Menu


  • Subject: Re: Getting the Frontmost Process's Name from the Script Menu
  • From: Philip Aker <email@hidden>
  • Date: Sun, 26 Aug 2007 01:03:05 -0700

On 2007-08-25, at 22:42:43, Jonathan Levi, M.D. wrote:

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?

You should be able to work from this:

set frapp to path to «constant afdregfp» as string
display dialog frapp

Philip Aker
email@hidden


 _______________________________________________
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: 
 >Getting the Frontmost Process's Name from the Script Menu (From: "Jonathan Levi, M.D." <email@hidden>)

  • Prev by Date: Re: Opening documents in App via Finder?
  • Next by Date: Re: AppleScript in Leopard
  • Previous by thread: Getting the Frontmost Process's Name from the Script Menu
  • Next by thread: Re: Getting the Frontmost Process's Name from the Script Menu
  • Index(es):
    • Date
    • Thread