It’s been quite a few moons since I did any of this manually but if I recall correctly…
a) Size is based upon the Finder icon size for the window. Don’t recall position but I think this is also Finder based.
b & c) Application folder is just a Finder alias to /Applications. The arrow is a result of this as well.
d) The text above/below is embedded into the background image (/.background folder in disk image with image being a TIFF.
Others might have more info on this as I don’t think any of this was documented very well by Apple and ended up being tribal knowledge.
If you’re not entirely dead set on doing everything from scratch, I highly recommend DMG Canvas which is also scriptable so that you can put things into a build script or CI/CD pipeline. There’s also DropDMG which is also very capable in this regard. Both are $25 for a license.
I’d guess you can / could find something in this
Its a post build script for Xojo that builds a DMG
Cant say more than that an whether it applies custom icons etc
tell application "Finder"
tell disk "MY_DMG"
open
tell container window
set current view to icon view
set toolbar visible to false
set statusbar visible to false
set x to 100
set y to 100
set w to 200
set h to 200
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 40
set arrangement to not arranged
set label position to bottom
set background color to {1,0,0}
end tell
end tell
update disk "MY_DMG"
delay 5
end tell
anyone know the correct AppleScript syntax for this line
‘’’
set background picture of opts to file <?????>
‘’’
the background image is stored in the DGM as
.background/image.jpg
FYI… it needs to be a JPG, because I want in stored in the bundle of the app the is CREATING the DMG, and you cannot access the Assets Catalog, and putting a PNG has all kinds of fork/resouce issues for some reason
set background picture of opts to file ":Volumes:XXXX_A:.background:dmg_bg2.jpg"
NSAppleScriptErrorMessage = "Finder got an error: Can\U2019t set file \":Volumes:XXXX_A:.background:dmg_bg2.jpg\" of disk \"XXXX_A\" to file \":Volumes:XXXX_A:.background:dmg_bg2.jpg\" of disk \"XXXX_A\".";
I also tried it by NOT changing the slashes to colons