How to move an icon to a certain screen location?

How can I move the icon of the file abc.pdf, stored on the Desktop, to the bottom right 1/6 of the secondary monitor, e.g. here:

First, you would have to find where the icon is, perhaps using the click at found image, or by some other means. Then you click there and then drag absolute to SCREEN(2,Left,83%),SCREEN(2,Top,83%).

Alternatively, you can probably do the whole thing with AppleScript which would be much more reliable.

1 Like

Hey @ALYB,

Place your file exactly where you want it and then select it.

Run this script from the Script to discover its desktop position.

tell application "Finder"
   set finderSelectionList to selection as alias list
   if length of finderSelectionList = 0 then error "No files were selected in the Finder!"
   set theItem to item 1 of finderSelectionList
   return desktop position of theItem
end tell

Insert the desired desktop position into this script.

tell application "Finder"
   tell item "abc.pdf"
      set desktop position to {160, 177}
   end tell
end tell

Run it from an Execute an AppleScript action.



Wow. This is exactly what I was looking for.

I posted in another thread that in Ventura 13.6.1 on my new M2 Mac Studio, my external-drive icons are moved to random places on the Desktop every time the Mac wakes from sleep and after each restart.

Fortunately, in that thread, KM user @August referred me here to your post. And your AppleScript solution works like a charm! Thank you, @ccstone!