AlienStar Posted August 26, 2009 Posted August 26, 2009 hello everybody I have this script to eject a cdrom in any windows which detect by itself and you don't have to put the name of drive $var = DriveGetDrive( "CDROM" ) If not @error Then For $i = 1 to $var[0] CDTray($var[$i] , "open") Next EndIf but if someone has two cdroms they both open when I start this script now : I wanna eject the cdrom which contain the script so I used this : $var = DriveGetDrive( "CDROM" ) If not @error Then For $i = 1 to $var[0] CDTray($var[$i] , "open" & @ScriptDir) Next EndIf but it didn't work please help ...................
Paulie Posted August 26, 2009 Posted August 26, 2009 Your script opens all the drives that are CDROMs because of the For...Next loop. $var = DriveGetDrive( "CDROM" ) If not @error Then For $i = 1 to $var[0] CDTray($var[$i] , "open") Next EndIf To open the drive that contains the script i would probably do this. $drive = StringLeft(@ScriptFullPath,2) If DriveGetType($Drive&"\") = "CDROM" Then CDTray($Drive,"Open")
AlienStar Posted August 26, 2009 Author Posted August 26, 2009 thanks so much Paulie it works ... >_<
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now