| 1 |
-- Source: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Packaging/CMakeDMGSetup.scpt |
| 2 |
on run argv |
| 3 |
set image_name to item 1 of argv |
| 4 |
|
| 5 |
tell application "Finder" |
| 6 |
tell disk image_name |
| 7 |
|
| 8 |
-- wait for the image to finish mounting |
| 9 |
set open_attempts to 0 |
| 10 |
repeat while open_attempts < 4 |
| 11 |
try |
| 12 |
open |
| 13 |
delay 1 |
| 14 |
set open_attempts to 5 |
| 15 |
close |
| 16 |
on error errStr number errorNumber |
| 17 |
set open_attempts to open_attempts + 1 |
| 18 |
delay 10 |
| 19 |
end try |
| 20 |
end repeat |
| 21 |
delay 5 |
| 22 |
|
| 23 |
-- open the image the first time and save a DS_Store with just |
| 24 |
-- background and icon setup |
| 25 |
open |
| 26 |
set current view of container window to icon view |
| 27 |
set theViewOptions to the icon view options of container window |
| 28 |
set background picture of theViewOptions to file ".background:background.tif" |
| 29 |
set arrangement of theViewOptions to not arranged |
| 30 |
set icon size of theViewOptions to 128 |
| 31 |
delay 5 |
| 32 |
close |
| 33 |
|
| 34 |
-- next setup the position of the app and Applications symlink |
| 35 |
-- plus hide all the window decoration |
| 36 |
open |
| 37 |
update without registering applications |
| 38 |
tell container window |
| 39 |
set sidebar width to 0 |
| 40 |
set statusbar visible to false |
| 41 |
set toolbar visible to false |
| 42 |
set the bounds to { 400, 100, 900, 465 } |
| 43 |
set position of item "merkaartor.app" to { 133, 200 } |
| 44 |
set position of item "Applications" to { 378, 200 } |
| 45 |
end tell |
| 46 |
update without registering applications |
| 47 |
delay 5 |
| 48 |
close |
| 49 |
|
| 50 |
-- one last open and close so you can see everything looks correct |
| 51 |
open |
| 52 |
delay 5 |
| 53 |
close |
| 54 |
|
| 55 |
end tell |
| 56 |
delay 1 |
| 57 |
end tell |
| 58 |
end run |