• 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: Problem updating disk icon position.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem updating disk icon position.


  • Subject: Re: Problem updating disk icon position.
  • From: OzSanta <email@hidden>
  • Date: Sat, 22 Jan 2011 13:25:23 +1100


On 22/01/2011, at 10:07 AM, OzSanta wrote:

G'day

Problem : I'm trying to update an applescript that automatically arranges icons.

Works fine for desktop icons EXCEPT those that are disk icons (kind =  Volume ). These can be moved, but the positions (desktop position) stay the same even when re-moved manually.

eg.  run the following script with the last line uncommented and a single desktop disk icon selected. Then move the disk icon to a new position. Comment out the line, and re-run with the same icon selected. The desktop position still shows as {600,100} even tho you've shifted the icon.

I've used several methods to refresh to desktop; none work to refresh the disk icon position.

Any advice please?

Regards

Santa

tell application "Finder"
set ptd to path to desktop
delete (make new folder at ptd)
update desktop
update (item 1 of (selection as alias as list))
properties of (item 1 of (selection as alias as list))
--set desktop position of (item 1 of (selection as list)) to {600, 100}
end tell


Here's a better script that shows the problem. Select a disk icon and move it, then run the script. The icon should bounce back to it's original position.

tell application "Finder"
set thecount to (count of (selection as list))
if thecount > 0 then
set temp to (item 1 of (selection as alias as list))
set DiskFlag to ((kind of temp) = "Volume")
if DiskFlag then
select disk temp
close window 1
set desktop position of disk temp to desktop position of disk temp
properties of disk temp
else
say "please select a disk icon"
end if
else
say "please select a disk icon"
end if
end tell


Here's a possible answer to the problem, but sometimes it doesn't work for some unfathomable reason.

tell application "Finder"
set thecount to (count of (selection as list))
if thecount > 0 then
set temp to (item 1 of (selection as alias as list))
set DiskFlag to ((kind of temp) = "Volume")
if DiskFlag then
quit
delay 0.4
try
activate
end try
select disk temp
close window 1
set desktop position of disk temp to desktop position of disk temp
properties of disk temp
else
say "please select a disk icon"
end if
else
say "please select a disk icon"
end if
end tell

Anyone know a better way to reset the finder? Quitting is rather drastic!

Regards

Santa







 _______________________________________________
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: 
 >Problem updating disk icon position. (From: OzSanta <email@hidden>)

  • Prev by Date: Problem updating disk icon position.
  • Next by Date: Re: Finder event question - scripting bridge, appscript [Solved]
  • Previous by thread: Problem updating disk icon position.
  • Next by thread: AppleScript to automatically paste clipboard image to a file.
  • Index(es):
    • Date
    • Thread