20 February 2007

Director: Finding the drive letter of a Windows CD-ROM

If you are creating Director Projectors which need to access data on the cd-rom drive the projector is distributed on you need to know the drive letter of the cd-rom drive.

Macromedia (now Adobe) gives us a nice solution in TN 3123 (google cache). This solution uses the fileIo Xtra to try open a uniquely named file on all of the drives. Since you provided the cd-rom, with the uniquely named file, you know that the drive which has this file is the drive you are looking for. The problem with this solution is: it doesn't work within a projector!

A much better way of finding the drive letter of the cd-rom drive the projector is currently running from is using the Lingo function the moviePath.
the moviePath contains the path of the directory the movie is current;y running out of, or in our case the cd-rom drive letter!

To build a path to a directory called "PDF" on the cd-rom, you'll only need the following Lingo:
set pdfPath = the moviePath & "PDF"

No comments: