PcExpert Posted April 6, 2006 Share Posted April 6, 2006 Hello, How to let the PC make a beep whil de CD Drives goes open? This is my code, but it doesn't work: CODE:Sleep(10000)CDTray ( "e:", "open" )Sleep(5000)CDTray ( "e:", "close" )While CDTray Beep("200", "3000")WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 6, 2006 Share Posted April 6, 2006 (edited) Hello, How to let the PC make a beep whil de CD Drives goes open? This is my code, but it doesn't work: CODE: Sleep(10000) CDTray ( "e:", "open" ) Sleep(5000) CDTray ( "e:", "close" ) While CDTray Beep("200", "3000") WEnd Your While statement doesn't work that way. Put some code for the beep in with the code to open the tray, like: CDTray("e:", "open") For $n = 1 to 5 Beep("200", "500") Sleep(500) Next CDTray("e:", "close") Hope that helps! P.S. If you mean to test _IF_ the tray is open from an AutoIT script, I don't know how, but would love to hear from someone who did... (pokes gurus in the ribs...) Edited April 6, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PcExpert Posted April 6, 2006 Author Share Posted April 6, 2006 Thanks, but what does line 2 do? Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 6, 2006 Share Posted April 6, 2006 Thanks, but what does line 2 do?Everything between FOR and NEXT is repeated (5 times in this case). This is a standard "For Loop". A basic thing you might as well learn now if you're ever going to script anything. Check out FOR and While in the help file, and play with the examples from there. Every level of scripting and programming from the DOS shell up to high level languages uses basic things like the For Loop, so it's worth learning. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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