Scripting FileStorm

rooSwitch Lite shipped with a disk image that was created using FileStorm. Previously I was using DropDMG, which is great, but I wanted something that let me use a background and position 128×128 icons on it. FileStorm was pretty easy to navigate with the UI, but I wanted to have this scripted. I had a hard time with some of it, so I’m posting my script here in hopes that it helps someone:

on run argv
    
    set appFile to item 1 of argv
    set applicationsAlias to item 2 of argv
    set backgroundImage to item 3 of argv
    set diskImageIcon to item 4 of argv
    set licenseAgreement to item 5 of argv
    set appName to “rooSwitch Lite”
    
    
    tell application “FileStorm”
        activate
        make new document at before first document with properties {name:appName, background image path:backgroundImage, height:387, width:512, volume name:appName, icon path:diskImageIcon}
        tell first document
            make new file at before first file with properties {file path:appFile, left position:55, top position:50} –(change path & file name to the location of your file)
            make new file at before first file with properties {file path:applicationsAlias, left position:280, top position:50} –(change path & file name to the location of your file)
            make new license agreement at before first license agreement with properties {language:”English”, text file path:licenseAgreement}
            
            finalize image with rebuilding
            
            repeat while building
                delay 1
            end repeat
        end tell
        
        quit
        
    end tell
    
end run

The script is then invoked from my “package.sh” shell script via “osascript”. That line looks like this:

osascript ./other_files/build_disk_image.scpt $BUILDDIR/rooSwitch\ Lite.app/ $BUILDDIR/Applications ${PWD}/other_files/roobasoft_disk_image.png ${PWD}/other_files/defaultvolumeicon.icns ${PWD}/other_files/license.txt

Disclaimer: I’m not an AppleScript guru. I barely get around with it. I just wanted to post this because I found FileStorm’s examples lacking in some areas (although this is based largely on their examples). Again, hopefully this helps someone.

Tip ‘o the hat to Jonathan Wight for educating me in the ways of SubEthaEdit’s “Copy as XHTML” magic.

Leave a Reply


© 2006 roobasoft, LLC