fiodal 0 Report post Posted May 1, 2004 Can someone help me please... What is the code to check if the CD ROM exists. And if it does, return the value or drive letter? Thanks.. Share this post Link to post Share on other sites
Nutster 3 Report post Posted May 1, 2004 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 NuttallNuttall Computer ConsultingAn Aquarius born during the Age of AquariusAutoIt allows me to re-invent the wheel so much faster.I'm off to write a wizard, a wonderful wizard of odd... Share this post Link to post Share on other sites
fiodal 0 Report post Posted May 1, 2004 Your a great help Thank you Nutster Share this post Link to post Share on other sites
fiodal 0 Report post Posted May 1, 2004 Nutster get an array error.. Where and how do I declare the array? if $x[0] >0 Then if $x^ERROR Error: Subscript used with non-Array variable. Share this post Link to post Share on other sites
scriptkitty 1 Report post Posted May 1, 2004 (edited) 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 May 1, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Share this post Link to post Share on other sites
herworth 0 Report post Posted May 1, 2004 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] Share this post Link to post Share on other sites
Valik 471 Report post Posted May 1, 2004 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). Share this post Link to post Share on other sites
Nutster 3 Report post Posted May 3, 2004 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 NuttallNuttall Computer ConsultingAn Aquarius born during the Age of AquariusAutoIt allows me to re-invent the wheel so much faster.I'm off to write a wizard, a wonderful wizard of odd... Share this post Link to post Share on other sites