| 1 |
on run (volumeName) |
| 2 |
tell application "Finder" |
| 3 |
tell disk (volumeName as string) |
| 4 |
open |
| 5 |
|
| 6 |
set theXOrigin to WINX |
| 7 |
set theYOrigin to WINY |
| 8 |
set theWidth to WINW |
| 9 |
set theHeight to WINH |
| 10 |
|
| 11 |
set theBottomRightX to (theXOrigin + theWidth) |
| 12 |
set theBottomRightY to (theYOrigin + theHeight) |
| 13 |
set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\"" |
| 14 |
|
| 15 |
tell container window |
| 16 |
set current view to icon view |
| 17 |
set toolbar visible to false |
| 18 |
set statusbar visible to false |
| 19 |
set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY} |
| 20 |
set statusbar visible to false |
| 21 |
REPOSITION_HIDDEN_FILES_CLAUSE |
| 22 |
end tell |
| 23 |
|
| 24 |
set opts to the icon view options of container window |
| 25 |
tell opts |
| 26 |
set icon size to ICON_SIZE |
| 27 |
set text size to TEXT_SIZE |
| 28 |
set arrangement to not arranged |
| 29 |
end tell |
| 30 |
BACKGROUND_CLAUSE |
| 31 |
|
| 32 |
-- Positioning |
| 33 |
POSITION_CLAUSE |
| 34 |
|
| 35 |
-- Hiding |
| 36 |
HIDING_CLAUSE |
| 37 |
|
| 38 |
-- Application and QL Link Clauses |
| 39 |
APPLICATION_CLAUSE |
| 40 |
QL_CLAUSE |
| 41 |
close |
| 42 |
open |
| 43 |
-- Force saving of the size |
| 44 |
delay 1 |
| 45 |
|
| 46 |
tell container window |
| 47 |
set statusbar visible to false |
| 48 |
set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10} |
| 49 |
end tell |
| 50 |
end tell |
| 51 |
|
| 52 |
delay 1 |
| 53 |
|
| 54 |
tell disk (volumeName as string) |
| 55 |
tell container window |
| 56 |
set statusbar visible to false |
| 57 |
set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY} |
| 58 |
end tell |
| 59 |
end tell |
| 60 |
|
| 61 |
--give the finder some time to write the .DS_Store file |
| 62 |
delay 3 |
| 63 |
|
| 64 |
set waitTime to 0 |
| 65 |
set ejectMe to false |
| 66 |
repeat while ejectMe is false |
| 67 |
delay 1 |
| 68 |
set waitTime to waitTime + 1 |
| 69 |
|
| 70 |
if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true |
| 71 |
end repeat |
| 72 |
log "waited " & waitTime & " seconds for .DS_STORE to be created." |
| 73 |
end tell |
| 74 |
end run |