Auto Launch an install app

How can you auto launch and install app that is on a dmg.

So that when it is downloaded it automatically launched the installer app that is on the dmg.

I think in the windows world it was something called autorun.

A lot of software has their launcher launch automatically, how do they do this?

In your macos settings of safari you can set to automatically open such as preview does with images. Not sure if it’s settable from within the dmg.

Edit: This may be relevant
https://stackoverflow.com/questions/5491166/how-i-make-a-dmg-installer-that-will-automatically-open-after-download

that would be something of a security hole so I doubt it
it should be user controllable and settable as it currently is (open safe files)

I don’t think there is any way to do that in a dmg.

If you really need that feature, consider distributing a macOS installer, which App Wrapper can create for you.