Re: DropStuff workaround (was Re: OS X and RegEx Commands)
Re: DropStuff workaround (was Re: OS X and RegEx Commands)
- Subject: Re: DropStuff workaround (was Re: OS X and RegEx Commands)
- From: John Cochrane <email@hidden>
- Date: Sun, 28 Dec 2003 00:20:16 +1100
The code I wrote earlier was very rushed and full of errors.
Below is a script to create a disk image and then gzip it onto the
desktop.
It is a variation on a script by Jean-Baptiste LE STANG
Watch out for line breaks.
set myRecord to (display dialog "Enter a name for your archive : "
default answer "")
set archiveName to text returned of myRecord
set button to button returned of myRecord
set selectedFile to choose file
tell application "Finder"
update selectedFile
end tell
set totalSize to size of (get info for (selectedFile as alias))
set archiveSize to (round 1.25 * totalSize / (1024 * 1024))
if archiveSize < 5 then set archiveSize to 5
if archiveName is not "" and button is not false then
my createDiskImage(archiveName, selectedFile, archiveSize)
end if
on createDiskImage(thisName, theFile, totalSize)
try
set filePath to POSIX path of theFile
set dmgPath to POSIX path of (path to temporary items) & thisName &
".dmg"
do shell script "hdiutil create -size " & totalSize & "m -fs HFS+
-volname " & thisName & " " & quoted form of dmgPath
do shell script "hdiutil mount " & quoted form of dmgPath
do shell script "ditto -rsrcFork " & quoted form of filePath & "
/Volumes/" & thisName
do shell script "hdiutil unmount /Volumes/" & thisName
do shell script "gzip -c " & quoted form of dmgPath & " >
~/Desktop/" & thisName & ".tgz"
on error errmsg
display dialog errmsg
end try
end createDiskImage
John
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.