milkman Posted February 17, 2006 Share Posted February 17, 2006 Here is my scirpt.; ----------------------------------------------------------------------------;; AutoIt Version: 3.1.0; Author: Calvin <teamgonuts@gmail.com>;; Script Function:; Opens CD Tray; Closes CD Tray; ----------------------------------------------------------------------------; Script Start - Add your code below hereAutoItSetOption( "TrayIconHide" , 1 )HotKeySet ( "\" , "close" )Func close () ExitEndFunc$m = 1While $m = 1HotKeySet ( "m" , "opencd" )WEndFunc opencd () CDTray ( "D:", "open" ) $m = 2EndFuncWhile $m = 2 HotKeySet ( "m" , "closecd")WEndFunc closecd () CDTray ("D:" , "close" ) $m = 1 EndFuncWhile 1=1 Sleep (100) WEndI hit 'm' once, the CD Tray opens.I hit 'm' again, the CD tray closes.I hit 'm' a third time, and instead of opening the CD tray again, nothing happens. What am I doing wrong? Link to comment Share on other sites More sharing options...
Oxin8 Posted February 17, 2006 Share Posted February 17, 2006 (edited) Global $CDTray HotKeySet("{ESC}", "Terminate") HotKeySet("m", "ShowMessage") ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func Terminate() Exit 0 EndFunc Func ShowMessage() If $CDTray Then CDTray ( "d:", "close" ) If Not $CDTray Then CDTray ( "d:", "open" ) $CDTray = NOT $CDTray EndFunc Code borrowed and edited. Originally written by Valuater. Edited February 17, 2006 by Oxin8 ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Valuater Posted February 17, 2006 Share Posted February 17, 2006 (edited) after the second "close" .. $m =1 and goes to the next position While 1=1 Sleep (100) ; while you are here... nothing happens WEnd ............. You should not place any "creates" inside a loop While $m = 2 HotKeySet ( "m" , "closecd") WEnd this sets the hot key over and over and over and.... 8) Edited February 17, 2006 by Valuater Link to comment Share on other sites More sharing options...
milkman Posted February 18, 2006 Author Share Posted February 18, 2006 after the second "close" .. $m =1 and goes to the next positionWhile 1=1Sleep (100) ; while you are here... nothing happensWEnd.............You should not place any "creates" inside a loopWhile $m = 2HotKeySet ( "m" , "closecd")WEndthis sets the hot key over and over and over and....8)So how can I fix this? Link to comment Share on other sites More sharing options...
Valuater Posted February 18, 2006 Share Posted February 18, 2006 So how can I fix this?Just use the code that Oxin8 gave above8) 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