Jump to content

GUICtrlRead Help !


Recommended Posts

GUICtrlRead deployment can not get the variable value

#include <GUIConstantsEx.au3>
#include <IE.au3>

Opt('MustDeclareVars', 1)



Example()

Func Example()
    Local $rmte, $destin, $txt, $msg, $Button_1, $Button_2, $user, $pwd, $idclie, $idcuen, $oIE, $rmtee, $destino, $txtt
    
$user = "xxxx"
$pwd = "xxxx"
$idclie = "xxxx"
$idcuen = "xxxx"
    
    GUICreate(" SitMobile", 420, 220, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
    
    GUICtrlCreateLabel("Remitente", 10, 6, 48)
    $rmte = GUICtrlCreateInput("", 70, 5, 300, 20)
    $rmtee = GUICtrlRead($rmte)
    GUICtrlSetLimit(-1, 11)


    GUICtrlCreateLabel("Celulares", 10, 38, 48)
    $destin = GUICtrlCreateInput("569XXXXXXXX,569XXXXXXXX", 70, 32, 300, 35,4)
    $destino = GUICtrlRead($destin)
    GUICtrlSetLimit(-1, 11)
    
    GUICtrlCreateLabel("Mensaje", 10, 75, 48)
    $txt = GUICtrlCreateInput("", 70, 75, 300, 80,4)
    $txtt = GUICtrlRead($txt)
    GUICtrlSetLimit(-1, 60)
    
    
    $Button_1 = GUICtrlCreateButton("Enviar", 70, 175, 60, 20)
    $Button_2 = GUICtrlCreateButton("Salir", 160, 175, 60, 20)
    



GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
               $oIE = _IECreate ("http://chile.sitmobile.com",0,1,1)
                Sleep(5000)
                _IENavigate($oIE,"http://chile.sitmobile.com:8765/MT_ClienteExterno.aspx?Text="&$txtt&"&Destinations="&$destino&"&Login="&$user&"&Password="&$pwd&"&IdClient="&$idclie&"&IdCuenta="&$idcuen&"&Remitente="&$rmtee)
                Sleep(5000)
                
                ;MsgBox(0, "out log", $out)
            Case $msg = $Button_2
                Exit
        EndSelect
    WEnd

EndFunc

if I run MsgBox (0, "log out", $ txtt), the variable $ txtt does not show anything

Help

Victor

Link to comment
Share on other sites

  • Moderators

sorry, where I use the code, give me an example !!! :)

thanks

victor

Think about this logically. AutoIt works line by line down unless in a loop or calling another function.

So, look at where you placed your GUICtrlRead(s), they are right after you create the control to read.

Now, ask yourself a question, "Are there any values created right after I create the control I want to read?

In your example, the only GUICtrlRead that would have a value is $destino.

You have to check GUICtrlRead every time before you are going to use it.

So fixing your code would look something like:

#include <GUIConstantsEx.au3>
#include <IE.au3>

Opt('MustDeclareVars', 1)



Example()

Func Example()
    Local $rmte, $destin, $txt, $msg, $Button_1, $Button_2, $user, $pwd, $idclie, $idcuen, $oIE, $rmtee, $destino, $txtt
   
    $user = "xxxx"
    $pwd = "xxxx"
    $idclie = "xxxx"
    $idcuen = "xxxx"
   
    GUICreate(" SitMobile", 420, 220, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
   
    GUICtrlCreateLabel("Remitente", 10, 6, 48)
    $rmte = GUICtrlCreateInput("", 70, 5, 300, 20)
    GUICtrlSetLimit(-1, 11)


    GUICtrlCreateLabel("Celulares", 10, 38, 48)
    $destin = GUICtrlCreateInput("569XXXXXXXX,569XXXXXXXX", 70, 32, 300, 35,4)
    GUICtrlSetLimit(-1, 11)
   
    GUICtrlCreateLabel("Mensaje", 10, 75, 48)
    $txt = GUICtrlCreateInput("", 70, 75, 300, 80,4)
    GUICtrlSetLimit(-1, 60)
   
   
    $Button_1 = GUICtrlCreateButton("Enviar", 70, 175, 60, 20)
    $Button_2 = GUICtrlCreateButton("Salir", 160, 175, 60, 20)
   



GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
               $oIE = _IECreate ("http://chile.sitmobile.com",0,1,1)
                Sleep(5000)
                $rmtee = GUICtrlRead($rmte)
                $destino = GUICtrlRead($destin)
                $txtt = GUICtrlRead($txt)
                _IENavigate($oIE,"http://chile.sitmobile.com:8765/MT_ClienteExterno.aspx?Text="&$txtt& _
                    "&Destinations="&$destino& _
                    "&Login="&$user& _
                    "&Password="&$pwd& _
                    "&IdClient="&$idclie& _
                    "&IdCuenta="&$idcuen& _
                    "&Remitente="&$rmtee)
                Sleep(5000)
               
                ;MsgBox(0, "out log", $out)
            Case $msg = $Button_2
                Exit
        EndSelect
    WEnd
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Think about this logically. AutoIt works line by line down unless in a loop or calling another function.

So, look at where you placed your GUICtrlRead(s), they are right after you create the control to read.

Now, ask yourself a question, "Are there any values created right after I create the control I want to read?

In your example, the only GUICtrlRead that would have a value is $destino.

You have to check GUICtrlRead every time before you are going to use it.

So fixing your code would look something like:

#include <GUIConstantsEx.au3>
#include <IE.au3>

Opt('MustDeclareVars', 1)



Example()

Func Example()
    Local $rmte, $destin, $txt, $msg, $Button_1, $Button_2, $user, $pwd, $idclie, $idcuen, $oIE, $rmtee, $destino, $txtt
   
    $user = "xxxx"
    $pwd = "xxxx"
    $idclie = "xxxx"
    $idcuen = "xxxx"
   
    GUICreate(" SitMobile", 420, 220, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
   
    GUICtrlCreateLabel("Remitente", 10, 6, 48)
    $rmte = GUICtrlCreateInput("", 70, 5, 300, 20)
    GUICtrlSetLimit(-1, 11)


    GUICtrlCreateLabel("Celulares", 10, 38, 48)
    $destin = GUICtrlCreateInput("569XXXXXXXX,569XXXXXXXX", 70, 32, 300, 35,4)
    GUICtrlSetLimit(-1, 11)
   
    GUICtrlCreateLabel("Mensaje", 10, 75, 48)
    $txt = GUICtrlCreateInput("", 70, 75, 300, 80,4)
    GUICtrlSetLimit(-1, 60)
   
   
    $Button_1 = GUICtrlCreateButton("Enviar", 70, 175, 60, 20)
    $Button_2 = GUICtrlCreateButton("Salir", 160, 175, 60, 20)
   



GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
               $oIE = _IECreate ("http://chile.sitmobile.com",0,1,1)
                Sleep(5000)
                $rmtee = GUICtrlRead($rmte)
                $destino = GUICtrlRead($destin)
                $txtt = GUICtrlRead($txt)
                _IENavigate($oIE,"http://chile.sitmobile.com:8765/MT_ClienteExterno.aspx?Text="&$txtt& _
                    "&Destinations="&$destino& _
                    "&Login="&$user& _
                    "&Password="&$pwd& _
                    "&IdClient="&$idclie& _
                    "&IdCuenta="&$idcuen& _
                    "&Remitente="&$rmtee)
                Sleep(5000)
               
                ;MsgBox(0, "out log", $out)
            Case $msg = $Button_2
                Exit
        EndSelect
    WEnd
EndFunc

thank you and is right in what I said, it will consider in the next programs. :)

Thanks for help du

Victor

Link to comment
Share on other sites

  • Moderators

you would help me with my question http://www.autoitscript.com/forum/index.php?showtopic=87565, please

Not really. You're too confusing for me to follow properly. I'd suggest posting your question in English and your native language.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...