tools/support/template.applescript
author alfadur
Sat, 26 Oct 2019 02:36:08 +0300
changeset 15504 4cc9ec732392
parent 9343 67552b2e20ca
permissions -rwxr-xr-x
refactor some of the room handler
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9343
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     1
on run (volumeName)
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     2
	tell application "Finder"
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     3
		tell disk (volumeName as string)
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     4
			open
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     5
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     6
			set theXOrigin to WINX
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     7
			set theYOrigin to WINY
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     8
			set theWidth to WINW
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
     9
			set theHeight to WINH
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    10
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    11
			set theBottomRightX to (theXOrigin + theWidth)
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    12
			set theBottomRightY to (theYOrigin + theHeight)
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    13
			set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    14
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    15
			tell container window
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    16
				set current view to icon view
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    17
				set toolbar visible to false
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    18
				set statusbar visible to false
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    19
				set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    20
				set statusbar visible to false
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    21
			end tell
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    22
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    23
			set opts to the icon view options of container window
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    24
			tell opts
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    25
				set icon size to ICON_SIZE
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    26
				set arrangement to not arranged
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    27
			end tell
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    28
			BACKGROUND_CLAUSE
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    29
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    30
			-- Positioning
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    31
			POSITION_CLAUSE
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    32
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    33
			-- Hiding
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    34
			HIDING_CLAUSE
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    35
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    36
			-- Application Link Clause
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    37
			APPLICATION_CLAUSE
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    38
            close
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    39
            open
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    40
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    41
			update without registering applications
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    42
			-- Force saving of the size
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    43
			delay 1
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    44
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    45
			tell container window
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    46
				set statusbar visible to false
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    47
				set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10}
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    48
			end tell
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    49
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    50
			update without registering applications
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    51
		end tell
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    52
		
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    53
		delay 1
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    54
		
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    55
		tell disk (volumeName as string)
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    56
			tell container window
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    57
				set statusbar visible to false
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    58
				set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    59
			end tell
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    60
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    61
			update without registering applications
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    62
		end tell
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    63
		
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    64
		--give the finder some time to write the .DS_Store file
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    65
		delay 3
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    66
		
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    67
		set waitTime to 0
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    68
		set ejectMe to false
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    69
		repeat while ejectMe is false
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    70
			delay 1
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    71
			set waitTime to waitTime + 1
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    72
			
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    73
			if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    74
		end repeat
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    75
		log "waited " & waitTime & " seconds for .DS_STORE to be created."
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    76
	end tell
67552b2e20ca import create-dmg script from https://github.com/andreyvit/yoursway-create-dmg
koda
parents:
diff changeset
    77
end run