Sign in to follow this  
Followers 0
PcExpert

Cdtray

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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...) :think:

Edited 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

Share this post


Link to post
Share on other sites

Thanks, but what does line 2 do?

Share this post


Link to post
Share on other sites

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. :think:


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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0