Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Make a .dmg from any directory' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Make a .dmg from any directory
Authored by: ov on Nov 05, '04 05:23:21PM

And here is an AppleScript version,
Just copy paste the following text into "Script Editor" and save it as an application
this script is a droplet, you only have to drop a folder onto the applescript application icon

[code]
on open (list_of_aliases)
set itemStr to (first item of list_of_aliases) as string
if (itemStr ends with ":") then
-- removes the ending ":" character
set itemStr to characters 1 through ((length of itemStr) - 1) of itemStr as string
createDMG(itemStr)
else
display dialog "The dropped element must be a folder and not a file" buttons {"Exit"} default button "Exit"
end if
end open

on createDMG(x)
set srcName to (POSIX path of x)
set targetName to srcName & ".dmg"
set srcName to quoted form of srcName
set targetName to quoted form of targetName

set scriptStr to "hdiutil create -fs HFS+ -srcFolder " & srcName & " " & targetName & " 2>&1 &"
say "Creating disk image from folder " & srcName
say "Please be patient ..."
display dialog "Please be patient ..." giving up after 2
do shell script scriptStr
set res to the result
display dialog res
end createDMG

[/code]


Regards
Olivier



[ Reply to This | # ]