slightly_abnormal Posted March 19, 2006 Share Posted March 19, 2006 How can I get this to toggle open of CD/dvd tray?? while 1 sleep(1) wend Func _cdtraye() CDTray ( "e:", "open" ) sleep(4000) CDTray ( "e:", "closed" ) EndFunc Func _cdtrayd() CDTray ( "d:", "open" ) sleep(4000) CDTray ( "d:", "closed" ) EndFunc #notrayicon Opt("TrayMenuMode",1) Opt("TrayOnEventMode",1) $CDTraye_tray = TrayCreateItem("Open/Close CD Tray") TrayItemSetOnEvent($Cdtraye_tray,"_CDtraye") $CDTrayd_tray = TrayCreateItem("Open/Close DVD Tray") TrayItemSetOnEvent($Cdtrayd_tray,"_CDtrayd") Link to comment Share on other sites More sharing options...
Andrew Sparkes Posted March 19, 2006 Share Posted March 19, 2006 (edited) I think that would be: Global $f="closed" Func _ToggleCDTray() While 1 If $f="closed" Then $open=CDTray ( "e:", "open" ) If $open=1 Then $f="open" Exitloop EndIf If $f="open" Then $close=CDTray ( "e:", "close" ) If $close=1 Then $f="closed" Exitloop EndIf WEnd EndFunc EDIT: Typo That should work, I hope... Sparkes. Edited March 19, 2006 by Andrew Sparkes ---Sparkes. Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 19, 2006 Author Share Posted March 19, 2006 Thanks!! Link to comment Share on other sites More sharing options...
busysignal Posted March 19, 2006 Share Posted March 19, 2006 I think that would be: Global $f="closed" Func _ToggleCDTray() While 1 If $f="closed" Then $open=CDTray ( "e:", "open" ) If $open=1 Then $f="open" Exitloop EndIf If $f="open" Then $close=CDTray ( "e:", "close" ) If $close=1 Then $f="closed" Exitloop EndIf WEnd EndFunc EDIT: Typo That should work, I hope... Sparkes. @ Sparkes, I just ran across that same issue you just pointed out of having the status predefined then taking action on the CDtray. Nice work! Cheers.. 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