Jump to content

Cd Rom


Recommended Posts

Try:

$x = DriveGetType("CDROM") ;Returns an array with all the CD-Rom's drive letters:

if $x[0] >0 Then
     $cdrom = $x[1]
else
     $cdrom = "" ;None found
endif

msgbox(0,"Insert Disk", "Please put the CD-Rom in drive " & $cdrom)

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

Yea, that isn't the right usage, it doesn't return an array:

DriveGetType

--------------------------------------------------------------------------------

Returns drive type.

DriveGetType ( "path" )

Parameters

path Path of drive to receive information from.

Return Value

Success: Returns the type of drive: "Unknown", "Removable", "Fixed", "Network", "CDROM", "RAMDisk"

Failure: Returns numeric 1 and sets @error to 1.

so usage would be DriveGetType ( "c:\" )

you can do DriveGetDrive ( "CDROM" ) like:

$var = DriveGetDrive( "CDROM" )
If NOT @error Then
    MsgBox(4096,"", "Found " & $var[0] & " drives")
    For $i = 1 to $var[0]
        MsgBox(4096,"Drive " & $i, $var[$i])
    Next
EndIf

just off by a few letters there

or:

$x = DriveGetDrive("CDROM");Returns an array with all the CD-Rom's drive letters:

if $x[0] >0 Then
    $cdrom = $x[1]
else
    $cdrom = "";None found
endif

msgbox(0,"Insert Disk", "Please put the CD-Rom in drive " & $cdrom)
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

I'm a very simple guy and I use this function

#include - once
local $CDDrive
Func FindCD()
$CDDrive = ""
for $x = 68 to 71
if fileexists(Chr($x) & ":\") then
$CDDrive = Chr($x) & ":\"
exitloop
endif
next
Return $CDDrive
EndFunc

It works fine every time for me.

[u][font="Arial"]Pete[/font][/u]
Link to comment
Share on other sites

One note, declaring something as Local outside the scope of a function doesn't make it local to the function, it makes it global (Local to global scope is still global to everything else is one way to rationalize that out).

Link to comment
Share on other sites

Yea, that isn't the right usage, it doesn't return an array:

just off by a few letters there

or:

$x = DriveGetDrive("CDROM");Returns an array with all the CD-Rom's drive letters:

if $x[0] >0 Then
    $cdrom = $x[1]
else
    $cdrom = "";None found
endif

msgbox(0,"Insert Disk", "Please put the CD-Rom in drive " & $cdrom)
Oops, wrong function. Sorry. Yeah I meant DriveGetDrive, not DriveGetType.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...