Jump to content

Error - User input GUI not recording proper values


Go to solution Solved by BrewManNH,

Recommended Posts

Hello,

 

I am running this code below.  I am attempting to validate data from a website to an excel sheet that I have.  I just want the user to enter the row, column and number of items which must be checked.  When these values are entered I get the values "4", "6", & "8" returned no matter what is typed in the first GUI box.   

 

Any suggestions, I am a bit over my head here.

 

Cheers,

 

 

 

/code

 Popup Message Box to start the script

$Erow = 0

$Column = 0

$For_n = 0

#include <GUIConstantsEx.au3>

#include <EditConstants.au3>

$MAIN = GUICreate("AutoIt Input Variables", 300, 160)

GUICtrlCreateLabel("Excel Row:", 10, 15, 100, 25)

$Erow = GUICtrlCreateInput("", 120, 10, 160, 25, $ES_NUMBER)

GUICtrlCreateLabel("Excel Column:", 10, 55, 100, 25)

$EColumn = GUICtrlCreateInput("", 120, 50, 160, 25, $ES_NUMBER)

GUICtrlCreateLabel("For Loop #:", 10, 95, 100, 25)

$For_n = GUICtrlCreateInput("", 120, 90, 160, 25, $ES_NUMBER)

$OK = GUICtrlCreateButton("OK", 60, 125, 60, 25)

$CANCEL = GUICtrlCreateButton("CANCEL", 180, 125, 60, 25)

GUISetState()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

    $msg = GUIGetMsg()

    Select

 Case $msg = $OK

           MsgBox(64, 'Variables' , ' The values entered are:' & @CRLF & '     Excel Row: is:  ' & $Erow  & @CRLF & '     Excel Column: is:  ' & $EColumn  & @CRLF  & '     For Loop Length is:  ' & $For_n )

   ExitLoop

   Case $msg = $CANCEL

   MsgBox(1, 'Script Shutdown' , 'You have Selected Cancel — Script is in shutdown process.')

   ExitLoop

    EndSelect

WEnd

/ecode

Link to post
Share on other sites
  • Solution

Use GUICtrlRead to get the contents of the control. The variables you're using only hold the control id of the control, not its contents.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

Common mistake when first staying out. :)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...