Sign in to follow this  
Followers 0
Public3nemy

help with input

3 posts in this topic

#include <GUIConstantsEx.au3>

GUICreate("Help File", 335, 40)
GUICtrlCreateLabel("Time", 8, 8)
$inputtime = GUICtrlCreateInput("", 40, 8, 95)
$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)
$stopbutton = GUICtrlCreateButton("Stop", 266, 8, 60)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()

    Select
        
        Case $msg = $startbutton        
                $time = GUICtrlRead($inputtime)     
            While 1
                Send("Hello!")
                Sleep($time)
            WEnd

        Case $msg = $stopbutton
            ExitLoop
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
    EndSelect
WEnd

For some reason when I add the time it still sends the key at the default time with no delay? =[

Share this post


Link to post
Share on other sites



What are you entering into the input box? You are probably entering seconds. If so, then you should read the help file a bit more carefully. For sleep, you must use milliseconds. So type in 5000 (5 seconds) and it should work.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

What are you entering into the input box? You are probably entering seconds. If so, then you should read the help file a bit more carefully. For sleep, you must use milliseconds. So type in 5000 (5 seconds) and it should work.

Oh man, can't believe I didn't pick that up.

How about if it asked for 2 inputs of time but when the user doesn't enter anthing in the second input the program skips it and just spams the first input that the user gave.

So if its left null it shouldn't send. Would I have to make an if statement? How would I do that?

#include <GUIConstantsEx.au3>

GUICreate("Help File", 335, 100)
GUICtrlCreateLabel("Time1", 8, 8)
GUICtrlCreateLabel("Time2", 8, 35)
$inputtime1 = GUICtrlCreateInput("", 40, 8, 95)
$inputtime2 = GUICtrlCreateInput("", 40, 35, 95)
$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)
$stopbutton = GUICtrlCreateButton("Stop", 266, 8, 60)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()

    Select
        
        Case $msg = $startbutton  
          
                $time1 = GUICtrlRead($inputtime1) 
        $time2 = GUICtrlRead($inputtime2)    
            
            While 1

                Send("Hello!")
                Sleep($time1)

        Send("What's up man?")
        sleep($time2)
            WEnd

        Case $msg = $stopbutton
            ExitLoop
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
    EndSelect
WEnd

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