Automatically Launch Mounted CDROM in Finder

I have searched these forums for this topic but couldn’t find anything close.

I have two issues which I need your valuable help on.

I have to distribute an Adobe Air Application for Windows/Mac/Linux OS’s. My initial aim was to use the autorun file in the CDROM and launch an html page in the browser. The user could just install the application from the browser.

This would have been a perfect solution for all OS’s but I have found out there is no “AutoPlay” feature in Mac OS X anymore. So I have to resort to packaging the contents and distributing it.

So for deploying on the Mac, I have built a software package using PackageMaker and have burnt it to a CDROM. The package basically contains “Adobe Air Runtime” and the Air application itself. Upon installation, I have told the target to be /tmp location. From there I run a postflight script to launch the Air Application Installer. This works perfectly now.

  1. Is this the right approach to go if I want to install an External application via the Packaged Software?
    1a) I have one drawback with this method. The Installer finishes “Installing” the Package, while my “Air Application” has just started to install itself.
  2. How can I get to launch Finder showing the contents of the CRDOM when it is mounted.
    2a) This should behave exactly like when you insert a Mac OS X Install disk. It opens the mounted disk in a new finder showing the contents of the disk.

Your help is appreciated.
cheers,
Jeffery

Model: MacBookPro
AppleScript: 2.0.1
Browser: Firefox 3.5.3
Operating System: Mac OS X (10.5)

Hi,

answer to 2) For security reasons autorun is not possible in OS X.
To open a Finder window of the disc volume automatically is possible AFAIK by burning the disc while the window is open

New volumes are mounted to /Volumes which is an invisible folder.
You could change finder-prefs (here a little script to toggle this setting)

set h to button returned of (display dialog "Make Finder show all files" buttons {"Yes", "nope, default"} default button {"YES"}) as text
if h = "Yes" then
	do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder"
else
	do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder"
end if

and the you could add a folder action to the folder Volumes on your startup disk, wrote a folder-action here.

You have to make an alias called “COPYALIAS” at your statup disk, to tell the script where to copy…

--Folder action to copy contents of inserted media to some other place...
on adding folder items to this_folder after receiving these_items
	try
		tell application "Finder"
			set b to POSIX path of ((original item of alias file "COPYALIAS" of startup disk) as alias)
		end tell
		repeat with this_ in these_items
			tell application "Finder"
				display dialog ("copy " & (name of this_) & "?") as text giving up after 3
				set itemname to name of this_
				set copypath to (original item of alias file "COPYALIAS" of startup disk)
				set a to POSIX path of this_
				--set a to (characters 1 through -2 of a) as text
			end tell
			set bb to checkname_now_suffix(itemname, copypath, false)
			do shell script "cp -R " & quoted form of a & " " & quoted form of b & quoted form of bb
			tell application "Finder"
				eject this_
			end tell
		end repeat
	on error msg
		tell application "Finder"
			activate
			display dialog msg
		end tell
	end try
end adding folder items to
on checkname_now_suffix(n, D, looped)
	tell application "Finder"
		set thefiles to name of every item of D
	end tell
	if thefiles contains n then
		if looped = false then
			set n to n & " 1"
		else
			set cc to count of every character of last word of n
			set cn to ((last word of n) as integer) + 1
			set n to ((characters 1 through (-1 * (cc + 1)) of n) as text) & cn
			checkname_now_suffix(n, D, counter, true)
		end if
	else
		return n
	end if
end checkname_now_suffix

Hi stefanK,

I kept the window open while burning. But it did not open the finder window automatically upon mount. The one thing I noticed though is it retained the finder window view to the same I had when I burned the CD.

I know this can be done as I have noticed in the Apple provided Install CD’s open up automatically when I insert them into the drive.

hubionmac,

I don’t know what your scripts are meant to do. What I want is a solution to work when I distribute a CD to clients. There is no control over the machines on which the CD-ROM is opened on.