Jump to content
aa2zz6

Return the results to a variable when a user inputs a integer inside a input box?

Recommended Posts

aa2zz6
Posted (edited)

How do I return the results to a variable when a user inputs a integer inside a input box?

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Global $result

Global $hGUI = GUICreate("Example", 400, 100)
Global $Inputbox = GUICtrlCreateInput("", 10, 30, 90, 20)
Global $btn = GUICtrlCreateButton("Start", 0, 0, 85, 25)
GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $btn
            $result = userinput(GUICtrlRead($Inputbox))
            ConsoleWrite($result)

    EndSwitch
WEnd

Func userinput($x)
    Sleep(1000)
    Send($x)
EndFunc   ;==>userinput

 

Edited by aa2zz6

Share this post


Link to post
Share on other sites
Earthshine

Assign a variable to GUIControlRead command Instead of just using it as an argument to that user function. That way you could send it to that user function as well just the variable

  • Like 1

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
aa2zz6

Thanks, that did the job!

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

×