Jump to content

How to write this variable in the func?


Nexx
 Share

Recommended Posts

Hello. Look at this script:

HOTKEYSET("{F5}", "parar")

Func PARAR()
    Exit 0
EndFunc


_Hello()

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 615, 438, 192, 126)
$n1 = GUICtrlCreateInput("", 40, 24, 145, 21)
$n2 = GUICtrlRead($n1)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Button1 = GUICtrlCreateButton("Read", 88, 64, 97, 57)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    if $nMsg = $Button1 then
        $5 = MsgBox(0,"manco",GUICtrlRead($n1))
    EndIf

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd


Func _Hello()
    MsgBox(0,$5,$5)
EndFunc

Well, what I basically want is to write a number or a name in a input on the GUI, and with that data, to work with it on a function (in this example, within a MsgBox command. How can I declare the variable in the function? Please helpp!

thanks

Link to comment
Share on other sites

HOTKEYSET("{F5}", "parar")

Func PARAR()
    Exit 0
EndFunc


;_Hello()

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 615, 438, 192, 126)
$n1 = GUICtrlCreateInput("", 40, 24, 145, 21)

GUICtrlSetBkColor(-1, 0xFFFFFF)
$Button1 = GUICtrlCreateButton("Read", 88, 64, 97, 57)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    if $nMsg = $Button1 then
        $n2 = GUICtrlRead($n1)
        $5 = MsgBox(0,"manco",GUICtrlRead($n1))
    EndIf

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd


Func _Hello()
    MsgBox(0,$5,$5)
EndFunc

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Not sure what you mean here, but I will take another attempt:

HOTKEYSET("{F5}", "parar")

Func PARAR()
    Exit 0
EndFunc


_Hello(123)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 615, 438, 192, 126)
$n1 = GUICtrlCreateInput("", 40, 24, 145, 21)
$n2 = GUICtrlRead($n1)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Button1 = GUICtrlCreateButton("Read", 88, 64, 97, 57)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    if $nMsg = $Button1 then
        $5 = GUICtrlRead($n1)
        _Hello($5)
    EndIf

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd


Func _Hello($a)
    MsgBox(0,$a,$a)
EndFunc
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...