Jump to content

Generating a GUI Using Arrays


Go to solution Solved by OJBakker,

Recommended Posts

Good morning everyone,

I've been lurking this forum for a couple of years, finding examples here to solve most of my questions. However, I've run into a problem I haven't been able to resolve, despite hours of searching and trying different potential solutions. Maybe I'm getting the syntax wrong. This community has provided so much useful information that I haven't really needed to post here before now.

I have a project that I've been working on that takes info I input into AutoIT and outputs XML data. I take pages and pages of information and put each point into 55 possible data points.

I have a script that works with just doing those 55 data points, one at a time.

I want to take those 55 data points, and be able to put in 10 instances of those data points at once. Normally I would do it one at a time (fill in 55 data points, output to XML, go to my next 55 data points, output to XML, etc.). I have a function that does this already, so I would just need to add a simple For loop to do this 10 times for me.

The data that's output would need to read from 1 of 4 possible sources in my GUI, so instead of creating 550x4 lines of code (filling up half of my available maximum for AutoIT scripts), I'm trying to write some code that will use Arrays and just generate the GUI for me. I figured I could use Eval() in order to reference the data I need later.

The problem I'm running into is trying to run a function that is called from the GUI generation portion of the program to create all 2200 variables and their associated GUICtrlCreate elements (not including labels). I'm not sure if I'm using Assign wrong, but I've also tried using Execute in place of Assign and it gives the same error code (Statement cannot be just an expression.).

I've attached my script below. This isn't generating ALL of the variables and GUI elements, just ONE portion. It has no problem generating the GUI elements themselves, my problem comes when I'm trying to create a Global variable that also references that GUI element so I can call it later.

I'm continuing to troubleshoot and search for solutions. If I find one I'll post it here as a response.

Thank you,

-J

Note: Line 149 is the problem child. If I remove the Assign portion, the entire GUI that I'm testing will generate normally

Note: All the #Include are not needed for this script, but are needed for the main script which I'm writing this for.

Lets Auto-Generate a GUI.au3

Link to post
Share on other sites
4 hours ago, OJBakker said:

Line 149 is wrong syntax.

Your line is

assign("varname", "") = "data"

correct syntax is: 

assign("varname", "data")

 

You beautiful person, thank you so much. I wasn't aware you could create GUI elements as the second part of Assign.

If anyone has a similar problem in the future, what I was attempting to do is create several GUI elements using an array.

I tried:

Assign($i & $j & $k & $l, "") = GUICtrlCreateInput($arr[0], $arr[1], $arr[2])

What I thought it'd be similar to:

Global $i = GUICtrlCreateInput($arr[0], $arr[1], $arr[2])

What it should be:

Assign($i & $j & $k & $i, GUICtrlCreateInput($arr[0], $arr[1], $arr[2]))

The array is global and can be referenced later using Eval and concatenating some other global variables depending on context and which button is pressed.

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