• 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 focus, slow getting icon position in window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting focus, slow getting icon position in window


  • Subject: Re: getting focus, slow getting icon position in window
  • From: Christopher Stone <email@hidden>
  • Date: Mon, 24 Jan 2011 13:36:58 -0600

On Jan 24, 2011, at 12:01, Michelle Steiner wrote:
Under no circumstances that I can think of, I never get the error dialog.
______________________________________________________________________

I believe the original poster wanted to know if the Desktop was frontmost.

If (windows whose visible is true) = {} then it's safe to proceed.  That's all I'm demonstrating.  I left it up to him to infer the rest - but perhaps I'm missing something.  The error handler is just generic.  (I see I didn't fully read his request.)

Getting items as 'alias list' is very fast.

set desktopFolder to path to desktop
tell application "Finder"
try
set sel to selection as alias list
if sel ≠ {} then
set itemParent to (parent of item 1 of sel) as alias
if itemParent = desktopFolder then
"Desktop is Focus"
else
"Window '" & (name of itemParent) & "' is Focus"
end if
end if
on error errMsg number errNum
beep
display dialog "Error: " & errMsg & return & "Error Number: " & errNum
end try
end tell

This runs in a fraction of a second on my Desktop with all items selected, in 0.8 seconds in a window with over 100 items selected, and 3.3 seconds in a window with 370 items selected. (MacBook Pro i7 2.66GHz)

set iconPosReco to {}
tell application "Finder"
try
set sel to (selection as alias list)
repeat with i from 1 to length of sel
set end of iconPosReco to {name, position, desktop position} of item i of sel
end repeat
on error errMsg number errNum
beep
display dialog "Error: " & errMsg & return & "Error Number: " & errNum
end try
end tell
iconPosReco

--
Chris
 _______________________________________________
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 focus, slow getting icon position in window (From: OzSanta <email@hidden>)
 >Re: getting focus, slow getting icon position in window (From: Michelle Steiner <email@hidden>)
 >Re: getting focus, slow getting icon position in window (From: Christopher Stone <email@hidden>)
 >Re: getting focus, slow getting icon position in window (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: A Lookup Function?
  • Next by Date: Re: AppleScript to automatically paste clipboard image to a file.
  • Previous by thread: Re:Lookup Table
  • Next by thread: Re: getting focus, slow getting icon position in window
  • Index(es):
    • Date
    • Thread