tools/support/template.applescript
changeset 9343 67552b2e20ca
equal deleted inserted replaced
9341:4dfebad83d51 9343:67552b2e20ca
       
     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 			end tell
       
    22 			
       
    23 			set opts to the icon view options of container window
       
    24 			tell opts
       
    25 				set icon size to ICON_SIZE
       
    26 				set arrangement to not arranged
       
    27 			end tell
       
    28 			BACKGROUND_CLAUSE
       
    29 			
       
    30 			-- Positioning
       
    31 			POSITION_CLAUSE
       
    32 			
       
    33 			-- Hiding
       
    34 			HIDING_CLAUSE
       
    35 			
       
    36 			-- Application Link Clause
       
    37 			APPLICATION_CLAUSE
       
    38             close
       
    39             open
       
    40 			
       
    41 			update without registering applications
       
    42 			-- Force saving of the size
       
    43 			delay 1
       
    44 			
       
    45 			tell container window
       
    46 				set statusbar visible to false
       
    47 				set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10}
       
    48 			end tell
       
    49 			
       
    50 			update without registering applications
       
    51 		end tell
       
    52 		
       
    53 		delay 1
       
    54 		
       
    55 		tell disk (volumeName as string)
       
    56 			tell container window
       
    57 				set statusbar visible to false
       
    58 				set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
       
    59 			end tell
       
    60 			
       
    61 			update without registering applications
       
    62 		end tell
       
    63 		
       
    64 		--give the finder some time to write the .DS_Store file
       
    65 		delay 3
       
    66 		
       
    67 		set waitTime to 0
       
    68 		set ejectMe to false
       
    69 		repeat while ejectMe is false
       
    70 			delay 1
       
    71 			set waitTime to waitTime + 1
       
    72 			
       
    73 			if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true
       
    74 		end repeat
       
    75 		log "waited " & waitTime & " seconds for .DS_STORE to be created."
       
    76 	end tell
       
    77 end run