Jump to content
Sign in to follow this  
Mcky

Please help. For variable usage in a GUI Control :(

Recommended Posts

Mcky

I assign

$num=1

$input1=GuiCtrlCreateInput...

However, when i set

Msgbox(0,"test",GuiCtrlRead($input&$num)) script error. help ? :)


My website: (Lots of AutoIt compiled programs+GameMaker games)http://mcky.sitesled.comMy AutoIt projects:Mcky's CalEntry - Calendar schedulingMcky's Web Extractor - Web page links extractorMcky's Appkey- Powerful Hotkey-listing tool[quote]I wish I was never born. I am just a lonely soul in this world... :([/quote]

Share this post


Link to post
Share on other sites
poisonkiller

You are trying to GUICtrlRead $num and that's what generates error. This should work:

MsgBox(0, "test", GUICtrlRead($input1) & $num)
Edited by poisonkiller

Share this post


Link to post
Share on other sites
Mcky

Sorry. I think it didn't worked :)

Error says uninitialized variable.

Edited by Mcky

My website: (Lots of AutoIt compiled programs+GameMaker games)http://mcky.sitesled.comMy AutoIt projects:Mcky's CalEntry - Calendar schedulingMcky's Web Extractor - Web page links extractorMcky's Appkey- Powerful Hotkey-listing tool[quote]I wish I was never born. I am just a lonely soul in this world... :([/quote]

Share this post


Link to post
Share on other sites
MHz

MsgBox(0, "test", GUICtrlRead($input1) & $num)

:)

Share this post


Link to post
Share on other sites
poisonkiller

Could you post your whole script please?

EDIT: MHz, you are fast, I was just about to fix it. :)

Edited by poisonkiller

Share this post


Link to post
Share on other sites
Mcky

$num=1
$input_hot1 = GUICtrlCreateInput("", 53, 245, 97, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY))
MsgBox(0,"a",GUICTRLREAD($input_hot&$num))

:)

Still won't work.


My website: (Lots of AutoIt compiled programs+GameMaker games)http://mcky.sitesled.comMy AutoIt projects:Mcky's CalEntry - Calendar schedulingMcky's Web Extractor - Web page links extractorMcky's Appkey- Powerful Hotkey-listing tool[quote]I wish I was never born. I am just a lonely soul in this world... :([/quote]

Share this post


Link to post
Share on other sites
poisonkiller

$num must be outside of GUICtrlRead(). And $input_hot is missing "1".

$num=1
$input_hot1 = GUICtrlCreateInput("", 53, 245, 97, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY))
MsgBox(0,"a",GUICTRLREAD($input_hot1) & $num)

Share this post


Link to post
Share on other sites
Mcky

Unfortunately it still doesn't work. Basically i got 60 input boxes and have been trying to read the data from them using the code stated above. $num is 1 to 60. :)


My website: (Lots of AutoIt compiled programs+GameMaker games)http://mcky.sitesled.comMy AutoIt projects:Mcky's CalEntry - Calendar schedulingMcky's Web Extractor - Web page links extractorMcky's Appkey- Powerful Hotkey-listing tool[quote]I wish I was never born. I am just a lonely soul in this world... :([/quote]

Share this post


Link to post
Share on other sites
poisonkiller

Then you should modify your code to something like this:

#include <GUIConstants.au3>
Dim $input_hot[61], $data = ""
GUICreate("60 inputs", ....)
$input_hot[1] = GUICtrlCreateInput("", ...)
$input_hot[2] = GUICtrlCreateInput("", ...)
......
For $i = 1 to 60
$data &= GUICtrlRead($input_hot[$i]) & @CRLF
Next
MsgBox(0, "test", $data)
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

EDIT: MHz-s code works too, so it's your choice which one to use.

Edited by poisonkiller

Share this post


Link to post
Share on other sites
Mcky

Thanks both of you. Sorry for troubling. Now trying, hopefully it works :)


My website: (Lots of AutoIt compiled programs+GameMaker games)http://mcky.sitesled.comMy AutoIt projects:Mcky's CalEntry - Calendar schedulingMcky's Web Extractor - Web page links extractorMcky's Appkey- Powerful Hotkey-listing tool[quote]I wish I was never born. I am just a lonely soul in this world... :([/quote]

Share this post


Link to post
Share on other sites
Misha

Shouldnt this be in the gui help section?

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
Sign in to follow this  

×