How to make a dmg file without using "hdiutil"

Hi,
Whenever I have to make a dmg file in a script, I use “hdiutil”. Nice and easy.
However, for a special purpose, I need to avoid using any shell scripting.
Is there any way to make a dmg file from a folder, using pure AppleScript?

As in?

Did you mean by ‘pure AppleScript’ without help of other applications as well?

I’m just wondering in which situation you’re not allowed to use shell scripting? It’s bundled in the standard addition scripting addition with means it isn’t even needed that Mac OS X is running to run your script unlike scripting third party software. Also you don’t need to have a third party software up and running which gives the application a more professional look.

AFAIK there isn’t an osax that can create disk images from an folder. hdiutil, drutil and diskutility are faceless commands but combined (lite) version with an interface is disk utility, it’s not directly scriptable but you can use GUI scripting. If ISO files, which is more versatile than DMG files, is an option as well you should take a look toast. I haven’t used it in years and from what I’ve heard it’s pretty commercial at the moment, so I don’t know how well AppleScript is supported nowadays.

I meant just plain AS commands (except for do shell script) and no 3rd party apps.

It is just a little project of mine to compare the UI effects of using equivalent AS or shell commands, from a user point if view. For instance, after always using ‘cp’ for copying, I tried ‘duplicate’ and found that the latter uses the system provided progress bar.

I hate GUI scripting with a passion. Tedious coding, broken by GUI changes. But, I may try this to see if it has any positive UI effect from a user prospective. Can you think of any?

The progress bar you see when you use the duplicate command in the Finder using AppleScript is because you’re tell the finder what to do like an end user. What I’m saying is that when you press cmd + D in the Finder the keys are send to the Finder application (read:process) and a function that duplicates the file which also show the progress bar will be called. When you’re using the duplicate command when the target application is the Finder you’re sending also an event, not an keyboard event but an Apple Event, to the finder. It will be read and call the same function that’s used when pressing CMD + D in the finder. Obvious you’ll see the same progress bar. It’s not an system provided progress bar but an Finder progress bar :slight_smile:

When you’re looking for something similar for creating DMG, that’s not possible. If you want an progress bar you could use Stefan’s SKPrgressBar project and monitoring the state of hdiutil and keeping the user up to date.

Hello.

I just want to say that a company called Coriolis, used to create a gui diskuitiity, (whether it is scriptable or not, I don’t know), but it supported a long list of formats, this worked for me, and is the sole reason I keep my Tiger box around.

Thank you for explaining the Finder’s roll there. That’s quite clear now. Regarding Stefan’s progress bar, I’m using it a lot, including for hdiutil. Just thought there may be a built-in alternative for some commands.