• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: DropStuff workaround (was Re: OS X and RegEx Commands)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: DropStuff workaround (was Re: OS X and RegEx Commands)
      • From: Graff <email@hidden>
References: 
 >OS X and RegEx Commands (From: Christian Vinaa <email@hidden>)
 >Re: OS X and RegEx Commands (From: Michael Grant <email@hidden>)
 >Re: OS X and RegEx Commands (From: Walter Ian Kaye <email@hidden>)
 >DropStuff workaround (was Re: OS X and RegEx Commands) (From: Walter Ian Kaye <email@hidden>)
 >Re: DropStuff workaround (was Re: OS X and RegEx Commands) (From: John Cochrane <email@hidden>)

  • Prev by Date: panning stereo sound
  • Next by Date: Re: DropStuff workaround (was Re: OS X and RegEx Commands)
  • Previous by thread: Re: DropStuff workaround (was Re: OS X and RegEx Commands)
  • Next by thread: Re: DropStuff workaround (was Re: OS X and RegEx Commands)
  • Index(es):
    • Date
    • Thread