Jump to content

variable Q


Recommended Posts

Can someone explain why can i I get the text from inputboxes? see Func Button1()

I want to loop through inputboxes & get the data. Seems like my variable is not understood by autoit

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode 

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 322, 178, 193, 115)
$Input1 = GUICtrlCreateInput("Input1", 24, 24, 113, 21)
$Input2 = GUICtrlCreateInput("Input2", 24, 56, 113, 21)
$Button1 = GUICtrlCreateButton("Button1", 176, 32, 65, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

; events
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlSetOnEvent($Button1, "Button1")


Func Button1()
     for $a = 1 to 2 ; check inputbox 1 & 2 
;~      if guictrlread($input & $a) = "" then MsgBox(0,'ALERT','Inputbox' & $a & ' is Empty!')
        MsgBox(0,'',GuiCtrlRead('$Input' & $a))
     Next
EndFunc

Func CLOSEClicked()
  Exit
EndFunc


While 1
  Sleep(1000)  ; Idle around
WEnd
Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

GUICtrlRead does not take a string as a variable, it takes the control id you got returned from GUICtrlCreate..., if you want to loop though the inputs save the control id's in an array and loop through the array.

:)

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Spoonfeeding time!

Do it like this:

Func Button1()
        MsgBox(0,'',GuiCtrlRead($Input1))
        MsgBox(0,'',GuiCtrlRead($Input2))
EndFunc

Eval takes the name of the variable as a string and returns the value of that variable. You *cannot* use a string as a variable name directly, like you intended to do.

Link to comment
Share on other sites

Do it like this:

MsgBox(0, '', Eval("Input"&$i))

And thanx Btw. :)

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
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...