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

getting focus, slow getting icon position in window


  • Subject: getting focus, slow getting icon position in window
  • From: OzSanta <email@hidden>
  • Date: Mon, 24 Jan 2011 21:17:36 +1100

G'day

I'm trying to update an icon positioner script that I posted on MacScripters several years ago.

I've got two 'be nice if I could' problems....

1. Is it possible in Applescript to determine if the desktop or a window is the Finders focus?

2. In the script below (condensed  from my whole script), organizing information of 30 selected icons on the desktop takes 1 second! Doing the same for 30 selected icons in a window takes 106 seconds, far too slow. Is there any way of using a shell script to both create a list of the selected icons, and getting the position of the icons? I note that when doing this for a finder window, the disk thrashes a bit, so it might not be possible to speed it up.

Regards, & thanks

Santa


tell application "Finder"
set KeepDate to current date
set KeepSelection to the selection
set thelist to the KeepSelection as list
set ListLength to count of thelist
set FoundDisk to false
set xx to ListLength
repeat with x from 1 to ListLength
if kind of item x of thelist as text ≠ "Volume" then
set xx to x
if FoundDisk then exit repeat
else
set FoundDisk to true
set KeepDisk to item x of thelist as alias
if xx < ListLength then exit repeat
end if
end repeat
set ThisItem to item xx of thelist
try
set we_are_on_desktop to ((container of ThisItem as alias) is (path to desktop folder))
on error
set we_are_on_desktop to (kind of ThisItem as text = "Volume") --< only Volume icons selected
end try
set XYlist to {}
set Xdifflist to {}
set ydiffList to {}
if we_are_on_desktop then
repeat with ThisItem from 1 to ListLength
set temp to desktop position of item ThisItem of thelist
set {end of XYlist, end of Xdifflist, end of ydiffList} to {temp, item 1 of temp, item 2 of temp}
end repeat
else
repeat with ThisItem from 1 to ListLength
set temp to position of item ThisItem of thelist
set {end of XYlist, end of Xdifflist, end of ydiffList} to {temp, item 1 of temp, item 2 of temp}
end repeat
end if
say (current date) - KeepDate as text
end tell

 _______________________________________________
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 focus, slow getting icon position in window
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Case Sensitive Format
  • Next by Date: Re: Mail Rule Scripts
  • Previous by thread: Re: Case Sensitive Format
  • Next by thread: Re: getting focus, slow getting icon position in window
  • Index(es):
    • Date
    • Thread