w_sp8er Posted January 5, 2004 Share Posted January 5, 2004 1stly to any admins, this is the 3rd time I've tried to post this. The 1st 2x when I wanted to preview the msg or submit it, I was asked for my name and password (even though I was already logged in). After resubmitting my name and password I was taken to the v3 support group, but with no sign of my request for help. (I tried going back to the 'Post a new topic' window in my history to recover & repost the request only to find it wiped. ...Ok now onto the 3rd posting... I'm having some problems with detecting which cdrom drive contains a specific cdrom. Code following: GLOBAL $OTN_CDLabel_cd1 $OTN_CDLabel_cd1 = "01-XX-XX OTN cd1" Get_OTN_CDDrive() EjectCd1_GetCd2() Exit Func Get_OTN_CDDrive() $ListOfDrives = DriveGetDrive ("CDROM") If @Error Then MsgBox (0,"Error!", "Error getting $ListOfDrives.") For $Count = 1 to $ListOfDrives[0] $DriveLabel = DriveGetLabel ($ListOfDrives[$Count]) If $DriveLabel = $OTN_CDLabel_cd1 Then $OTN_CDDrive = $ListOfDrives[$Count] ExitLoop EndIf Next EndFunc Func EjectCd1_GetCd2() CDTray ($OTN_CDDrive, "open") MsgBox (0, "Swap CDs", "Please remove OTN cd1 and put in OTN cd2. Press OK to continue.") CDTray ($OTN_CDDrive, "close") EndFunc Any help with the above code would be greatly appreciated. Link to comment Share on other sites More sharing options...
GrahamS Posted January 5, 2004 Share Posted January 5, 2004 You appear to have an assignment in the if statement when you want an equality check, i.e. it should read If $DriveLabel == $OTN_CDLabel_cd1 Then (note the double equals sign) HTH GrahamS Link to comment Share on other sites More sharing options...
trids Posted January 5, 2004 Share Posted January 5, 2004 (edited) Also .. $OTN_CDDrive is local to Func Get_OTN_CDDrive(), and is not available in Func EjectCd1_GetCd2() where you try and eject the CD.You either need to declare it globally, or passit out of the Get_OTN_CDDrive() function (and into EjectCd1_GetCd2() .. as a parm) Edited January 5, 2004 by trids Link to comment Share on other sites More sharing options...
w_sp8er Posted January 5, 2004 Author Share Posted January 5, 2004 in my complete script i have declared all variable as GLOBAL GrahamS, thank you. that fixed it right up. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 5, 2004 Developers Share Posted January 5, 2004 (edited) think that = should work the same as == Agree with Trids that you need to define the $OTN_CDDrive var in the top part of the program.CyberSlug wrote in another post:In AutoIt, = and == have the same meaning for numbers--I think. However, the == is a case-sensitive test for strings."abc" = "ABC" ;evaluates to True"abc" == "ABC" ;evaluates to FalseJos Edited January 5, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
spt Posted January 9, 2004 Share Posted January 9, 2004 or u can have it check for a filename on the cd (maybe) ~~ Safeguarding The Land ~~ Link to comment Share on other sites More sharing options...
MattNis Posted January 9, 2004 Share Posted January 9, 2004 hopefully this works. EjectCd1_GetCd2(Get_OTN_CDDrive("01-XX-XX OTN cd1")) Exit Func Get_OTN_CDDrive($OTN_CDLabel_cd1) $ListOfDrives = DriveGetDrive ("CDROM") If @Error Then MsgBox (0,"Error!", "Error getting $ListOfDrives.") For $Count = 1 to $ListOfDrives[0] $DriveLabel = DriveGetLabel ($ListOfDrives[$Count]) If $DriveLabel = $OTN_CDLabel_cd1 Then return $OTN_CDDrive; Next EndFunc Func EjectCd1_GetCd2() CDTray ($OTN_CDDrive, "open") MsgBox (0, "Swap CDs", "Please remove OTN cd1 and put in OTN cd2. Press OK to continue.") CDTray ($OTN_CDDrive, "close") EndFunc [quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote] Link to comment Share on other sites More sharing options...
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