Jump to content

CD Drive Work-out script help


Recommended Posts

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 131,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$i = GuiCtrlCreateInput("", 160, 60, 40, 20)
$Submit = GuiCtrlCreateButton("Lets Go!", 150, 100, 70, 20)
$Info = GuiCtrlCreateLabel("How many times do you want your cd drive to work out?", 70, 10, 270, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Do
    CDTray("E:", "open");
    CDTray("E:", "close");
    $i = $i - 1
Until $i = 0

I have just began coding in this language, and am trying to create a small, funny, cd work-out program. I have gotten this far, but I do not understand how I would get the GUI to work like it should, or at all for that matter, and I would also like to make the GUI not let the numeber be set below 1 (so people do not make someones computer cd drive go in and out indeffinetly without having to do some kind of work).

Link to comment
Share on other sites

due to this being your first script i do not like the maliciousness of it :-/ but here take a look at this but promise you will not make viruses or malicious code in autoit :whistle:

#include <GuiConstants.au3>
GuiCreate("MyGUI", 392, 131,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$times = GuiCtrlCreateInput("", 160, 60, 40, 20)
$Submit = GuiCtrlCreateButton("Lets Go!", 150, 100, 70, 20)
$Info = GUICtrlCreateLabel("How many times do you want your cd drive to work out?", 70, 10, 270, 20)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Submit
            If Not StringIsDigit(GUICtrlRead($times)) Then
                MsgBox(0,"Error","Not A Number")
            Else
                $drive = DriveGetDrive("CDROM")
                If IsArray($drive) Then
                For $i = 1 to GUICtrlRead($times)
                    $msg = GUIGetMsg()
                    If $msg = $GUI_EVENT_CLOSE THen Exit
                    CDTray($drive[1],"open")
                    CDTray($drive[1],"close")
                Next
                MsgBox(0,"Done","CDROM Workout Complete")
            Else
                MsgBox(0,"Error","Error No CDROM Drives")
            EndIf
        EndIf
    Case $msg = $GUI_EVENT_CLOSE
        Exit
EndSelect
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...