Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SDDave2007

macrumors regular
Original poster
Apr 12, 2007
197
1
I have the following script that customizes a DMG....
The problem is ... contrary to what the script says.... The icons are NOT located at the coordinates specified. The ones that would be along the top
are "close".. the lower/right icons are way off. I also notice that if I change the X/Y of the window in the script the position of the icons change.

What am I doing wrong/missing here? I need to have the icons appear at the specified coordinates relative to the top left corner of the window

Code:
tell application "Finder"
tell disk "test_test.dmg"
   open
   tell container window
      set current view to icon view
      set toolbar visible to false
      set statusbar visible to false
      set x to 251
      set y to 220
      set w to 1009
      set h to 612
      set bounds to {x, y, x + w, y + h}
   end tell
   set opts to icon view options of container window
   tell opts
      set shows icon preview to false
      set shows item info to false
      set icon size to 128
      set text size to 16
      set arrangement to not arranged
      set label position to bottom
      set background color to {32639,0,32639}
   end tell
   set position of file "aaa_test01.app" to {25,96}  
   set position of file "aaa_test02.app" to {803,213}
   set position of file "aaa_test03.app" to {585,68}
   set position of file "aaa_test04.app" to {485,388}
   set position of file "aaa_test05.app" to {52,295}
   set position of file "aaa_test06.app" to {792,30}
   set position of file "aaa_test07.app" to {211,51}
   set position of file "aaa_test08.app" to {439,207}
   set position of file "aaa_test09.app" to {823,406}
   set position of file "aaa_test10.app" to {293,391}
   set position of file "aaa_test11.app" to {381,13}
   set position of file "aaa_test12.app" to {214,226}
   set position of file "aaa_test13.app" to {649,443}
   update without registering applications
   delay 5
end tell
end tell
 

SDDave2007

macrumors regular
Original poster
Apr 12, 2007
197
1
Thanks... but I need to create the whole thing via a script. I have everything I need working perfectly... EXCEPT... that the icons do not appear where I tell them to.

The DMG is created... the background color/image is set, the files are all copied in.. .every thing is perfect.... but for that ONE last critical item.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
It seems to work OK to me, but I may be misunderstanding the intention. I attached an image, at full resolution, of what I get on my system. It seemed to be what the script was asking for.

-Lee

n/m: I see some issues now... just wasn't sure what it was "supposed" to look like.
 

Attachments

  • result.jpg
    result.jpg
    130 KB · Views: 99

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
OK, no solution yet, BUT...
I put delay 2 between each positioning... and it seems that it thinks the objects are being positioned "off" the window... and when that happens, it adjusts the position of the "working area" of the window, so the coordinates are not relative to each other, only relative to the position of the "working area" when they're particular set position is run. I'll poke at it a bit more, really not familiar with this stuff.

-Lee
 

SDDave2007

macrumors regular
Original poster
Apr 12, 2007
197
1
I did seem to notice that all the icons would flash towards the upper left hand corner and then "bounce" back into the window ending up at the wrong locations....

I wonder if the positioning is absolute and not relative..... as in you have to add the windows top and left coordinates....

What the heck..... at this point I'll try anything
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I did seem to notice that all the icons would flash towards the upper left hand corner and then "bounce" back into the window ending up at the wrong locations....

I wonder if the positioning is absolute and not relative..... as in you have to add the windows top and left coordinates....

What the heck..... at this point I'll try anything

I tried adding x and y, no dice. that was even worse. I'll poke at it a bit more later. I'm not sure if the coordinate you give is the center of the icon, or the top right, or the top left, or what. If it's the center... you shouldn't position anything within 64 pixels of the sides, since you have the icons set to 128x128.

-Lee

p.s. I don't know what it should look like, but adding 64 to each value in each coordinate seemed to be better than the way they were before. i attached the resulting window with that change.
 

Attachments

  • result2.jpg
    result2.jpg
    130.6 KB · Views: 91

SDDave2007

macrumors regular
Original poster
Apr 12, 2007
197
1
I FOUND IT!!!!

A) you have to add 1/2 the icon size to both the X and Y coordinates

B) the Left edge of the Icon (or its label) cannot be less than 13 pixels from the left edge

C) the Top of the Icon cannot be less than 10 pixels from the top of the window

Do all of those things.... and it lines up PERFECT... at all icon sizes

B & C are both After you have done "A"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.