Chimaera Posted May 2, 2014 Share Posted May 2, 2014 Its a simple one i guess, but im trying to open the dvd drive then wait 5 secs then close it again Should be simple enough but i get the right delay between the open and close but the script runs on for another 10 secs or so before closing? Global $var = DriveGetDrive( "CDROM" ) If not @error Then For $i = 1 to $var[0] Local $var2 = CDTray($var[$i] , "open") Next Sleep(5000) For $i = 1 to $var[0] $var2 = CDTray($var[$i] , "closed") Next EndIf Even with exit at the end it still runs on Any thoughts If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
JohnOne Posted May 2, 2014 Share Posted May 2, 2014 Must just take a while to register that it's closed. I'm not sure of the internal API used but it's possible it has a return immediately flag. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 2, 2014 Moderators Share Posted May 2, 2014 Just out of curiosity, try something like this to see if it still hangs (am not where I can test at the moment): $wmp = ObjCreate("WMPlayer.OCX.7" ) $colCDROMs = $wmp.cdromCollection If $colCDROMs.Count >= 1 Then For $i = 0 to $colCDROMs.Count - 1 $colCDROMs.Item($i).Eject Sleep(5000) $colCDROMs.Item($i).Eject Next EndIf "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JohnOne Posted May 2, 2014 Share Posted May 2, 2014 (edited) It appeared to JLo, but after testing... $wmp = ObjCreate("WMPlayer.OCX.7") $colCDROMs = $wmp.cdromCollection If $colCDROMs.Count >= 1 Then ;For $i = 0 To $colCDROMs.Count - 1 $colCDROMs.Item(0).Eject ;Beep(700, 100) Sleep(5000) ;Beep(700, 100) $colCDROMs.Item(0).Eject Beep(700, 100) ;Next EndIf That never, so it's possible that it's opening and closing my virtual clonedrive disc. EDIT: confirmed, 2 beeps from below. $wmp = ObjCreate("WMPlayer.OCX.7") $colCDROMs = $wmp.cdromCollection If $colCDROMs.Count >= 1 Then For $i = 0 To $colCDROMs.Count - 1 $colCDROMs.Item($i).Eject ;Beep(700, 100) Sleep(2000) ;Beep(700, 100) $colCDROMs.Item($i).Eject Beep(700, 100) Next EndIf Another 2 beeps below. Global $var = DriveGetDrive( "CDROM" ) If not @error Then For $i = 1 to $var[0] Local $var2 = CDTray($var[$i] , "open") Next Sleep(2000) For $i = 1 to $var[0] $var2 = CDTray($var[$i] , "closed") Beep(700,100) Next EndIf One beep, no delay below Global $var = DriveGetDrive( "CDROM" ) If not @error Then ;For $i = 1 to $var[0] Local $var2 = CDTray($var[1] , "open") ;Next Sleep(2000) ;For $i = 1 to $var[0] $var2 = CDTray($var[1] , "closed") Beep(700,100) ; Next EndIf Edited May 2, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Chimaera Posted May 3, 2014 Author Share Posted May 3, 2014 (edited) I tried the wmplayer ones but i dont have it installed on my machine so it throws an must be object error The last one of JohnOne's Works as it should, many thanks Global $var = DriveGetDrive( "CDROM" ) If not @error Then Local $var2 = CDTray($var[1] , "open") Sleep(7000) $var2 = CDTray($var[1] , "closed") Beep(700,100) EndIf Thing is what happens if you have multiple drives will it still open them all without the For/Next ? Edited May 3, 2014 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
JohnOne Posted May 3, 2014 Share Posted May 3, 2014 No, so you'd have to determine in loop if drive is physical or virtual and skip latter. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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