Jump to content


Photo

Control Variables Went Missing?


  • Please log in to reply
4 replies to this topic

#1 Stomp

Stomp
  • Members
  • 5 posts

Posted 23 June 2012 - 10:21 PM

Long story short...I can't seem to get control variables anymore, and I have no idea why.
Here is an example (complete) script:

Gui, Add, Tab2, vvar1 Hwndwnd1, This|That
OutputDebug % "var1 = " var1
OutputDebug % "wnd1 = " wnd1
Gui, Add, ListView, vvar2 Hwndwnd2, Mine|Yours
OutputDebug % "var2 = " var2
OutputDebug % "wnd2 = " wnd2
Gui Show
The code works, the gui shows nicely. But...
And here is the output:

[6168] var1 =
[6168] wnd1 = 0x1e087c
[6168] var2 =
[6168] wnd2 = 0x2c0878
I swear I was getting values just yesterday for the control variable :(
Any ideas on how I could have managed to lose control variables?

TIA

#2 Guests

  • Guests

Posted 23 June 2012 - 11:00 PM

I think you're missing:

Gui,Submit,NoHide

<!-- m -->http://www.autohotke.../Gui.htm#Submit<!-- m -->

#3 Stomp

Stomp
  • Members
  • 5 posts

Posted 23 June 2012 - 11:30 PM

I appreciate your response!

However, most example scripts in the documentation that use control variables do not have any instances of Gui Submit.

Plus, my code worked yesterday and I have never used that particular command.
Thanks again though!

#4 Leef_me

Leef_me
  • Moderators
  • 7704 posts

Posted 24 June 2012 - 02:32 AM

I spte of your claims:

There are 2 pricipal ways to get data results from a control. These are the easiest to use.
Gui, Submit
GuiControlGet

There are also these commands which work on windows of external programs,
but getting the data is a little more difficult.
ControlGet
ControlGetText
DllCall() <--- most difficult

If you had data, by any other method, it was NOT from the controls your script adds
It is possible that the data was in the variables from some other operation.

#5 Lexikos

Lexikos
  • Administrators
  • 8845 posts

Posted 24 June 2012 - 05:47 AM

I think Leef_me means "In spite"... and "2 principal ways". ;)

More to the point, Gui control variables are not updated automatically.

V: Variable. Associates a variable with a control. Immediately after the letter V, specify the name of a global variable (or a ByRef local that points to a global, or a static variable in v1.0.46.01+). For example, specifying vMyEdit would store the control's contents in the variable MyEdit whenever the Gui Submit command is used.
Source: GUI - Storing and Responding to User Input

If your code worked yesterday, it must have changed since then.

However, most example scripts in the documentation that use control variables do not have any instances of Gui Submit.

I presume those examples either use GuiControlGet, or they don't retrieve the value from the control. Gui control variables are often used simply to identify the control.