• 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 app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Frontmost app


  • Subject: Re: Frontmost app
  • From: Steve Roy <email@hidden>
  • Date: Fri, 17 Jan 2003 09:03:53 -0500

email@hidden (Emmanuel) wrote:

> Not any better way that I know.

Thank you everybody for your answers. I was wondering if I had missed something
obvious.

I did a test to compare the speed of the 'path to' solution with my previous
solution.

on run
set theStartTime to current date
repeat 1000 times
getFrontApplication1()
end repeat
set theEndTime to current date
set theDiff to theEndTime - theStartTime
display dialog theDiff
end run

on getFrontApplication1()
tell application "Finder"
set theList to name of every process whose frontmost is true
end tell
return application (theList as string)
end getFrontApplication1

on getFrontApplication2()
return application (path to frontmost application as string)
end getFrontApplication2

Called a thousand times, my original method took 47 seconds to complete. The
'path to' solution did the same thing in 2 seconds.

Steve

--
Steve Roy <email@hidden>
_______________________________________________
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.

References: 
 >Re: Frontmost app (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Still cannot record anything in Script Editor
  • Next by Date: Re: Still cannot record anything in Script Editor
  • Previous by thread: Re: Frontmost app
  • Next by thread: Mounting Windows 2003 vis AppleScript
  • Index(es):
    • Date
    • Thread