File: dmgfix

package info (click to toggle)
sopwith 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,536 kB
  • sloc: ansic: 11,983; sh: 4,964; xml: 137; makefile: 130; python: 96
file content (64 lines) | stat: -rwxr-xr-x 2,045 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/osascript
--
-- Copyright(C) 2009-2014 Simon Howard
--
-- You can redistribute and/or modify this program under the terms of the
-- GNU General Public License version 2 as published by the Free Software
-- Foundation, or any later version. This program is distributed WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE.
--
--
-- AppleScript script to automatically set the view properties in a
-- .dmg file - ie. the background image, other Finder view options
-- and icon positions.
--
-- Usage: dmgfix <absolute path to dmg> <disk name> <name of app>
--

on run argv
    set dmgFile to POSIX file (item 1 of argv)
    set diskName to item 2 of argv
    set appName to item 3 of argv

    tell application "Finder"
        --activate
        open dmgFile
        delay 1
        set theDisk to disk diskName
        open POSIX file "/"

        -- window options:

        set bgfile to file "background.png" of theDisk
        set win to the front Finder window
        tell win
            set target to theDisk
            set current view to icon view
            set sidebar width to 0
            set toolbar visible to false
            set statusbar visible to false
            set bounds to {200, 200, 850, 630}
        end tell
        tell icon view options of win
            set icon size to 48
            set background picture to bgfile
        end tell

        -- hide background file:

        set bgloc to quoted form of POSIX path of (bgfile as text)
        do shell script "SetFile -a V " & bgloc

        -- icon positions:

        set position of file "Software License" of theDisk to {500, 300}
        set position of file appName of theDisk to {320, 200}
        set position of file "Applications" of theDisk to {500, 30}
        set position of folder "Documentation" of theDisk to {140, 300}
        set position of document file "Problems Running the Game?.rtfd" of theDisk to {320, 300}

        eject theDisk
    end tell
end run