Sign in to follow this  
Followers 0
moonglow

Little problem with eval()

7 posts in this topic

Hi there,

I'm new to this forum, so I'll shortly introduce myself :-)

I'm working a a software packager for a company in Germany and sometimes we can't get some products installed silently, thats where AutoIt comes in :-) What can I say, AutoIt rules!

I now try go make my life a bit easier to write a small tool to automate some of our processes.

Ok, now for the obvious, my question :-)

Here is what I want to do: Construct a call to create a GUI object, it works fine as long as the object i want to eval() is no array. To make it a bit more clear:

The following works well if: $aInput[$i][$field] = $something

It does not work if: $aInput[$i][$field] = $something[1]

$result = assign($aInput[$i][$field] & '_' & $i,GUICtrlCreateInput(eval(StringRight($aInput[$i][$text],StringLen($aInput[$i][$text])-1)), .....)

I don't understand where the difference is for the funtion eval(), if it's a plain variable or a array variable.

Has somebody any clue how to get around this (maybe there is an additional function I haven't found yet)?

Thanx a lot in advance,

Greetings from Germany

Share this post


Link to post
Share on other sites



Hi there,

I'm new to this forum, so I'll shortly introduce myself :-)

I'm working a a software packager for a company in Germany and sometimes we can't get some products installed silently, thats where AutoIt comes in :-) What can I say, AutoIt rules!

I now try go make my life a bit easier to write a small tool to automate some of our processes.

Ok, now for the obvious, my question :-)

Here is what I want to do: Construct a call to create a GUI object, it works fine as long as the object i want to eval() is no array. To make it a bit more clear:

The following works well if: $aInput[$i][$field] = $something

It does not work if: $aInput[$i][$field] = $something[1]

$result = assign($aInput[$i][$field] & '_' & $i,GUICtrlCreateInput(eval(StringRight($aInput[$i][$text],StringLen($aInput[$i][$text])-1)), .....)

I don't understand where the difference is for the funtion eval(), if it's a plain variable or a array variable.

Has somebody any clue how to get around this (maybe there is an additional function I haven't found yet)?

Thanx a lot in advance,

Greetings from Germany

both of your examples looks like they should work, but that would be making some assumptions. could you include your whole script,, or atleast the part where $something[1] is assigned a value?

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

both of your examples looks like they should work, but that would be making some assumptions. could you include your whole script,, or atleast the part where $something[1] is assigned a value?

Thanks for your response,

you could really assign any value to the variable:

example: working:

$something = "whats up"

not working:

Dim $something[1]

$something[0] = "whats up now"

The only difference is that eval() will work on an array in the second example, and that ends up with a blank string instead of "whats up now". It also returns @error 1

Share this post


Link to post
Share on other sites

Thanks for your response,

you could really assign any value to the variable:

example: working:

$something = "whats up"

not working:

Dim $something[1]

$something[0] = "whats up now"

The only difference is that eval() will work on an array in the second example, and that ends up with a blank string instead of "whats up now". It also returns @error 1

why do you need to use eval? i'm going to try to recreate your error over here and see what i can't figure out.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

why do you need to use eval? i'm going to try to recreate your error over here and see what i can't figure out.

O.k. to make myself a bit more clear, I have cleaned up the small test prog a bit and will attach it to my posting.

You will see that I want to read some descriptions and values out of arrays to be able to create a variable number of lines in the GUI and I didn't find any other way to do it.

If you look at it, please bear in mind that it still is very incomplete, I use this part for quick checks before it makes it's way into my main prog :oarraytest1.zip

Share this post


Link to post
Share on other sites

Thanks for your response,

you could really assign any value to the variable:

example: working:

$something = "whats up"

not working:

Dim $something[1]

$something[0] = "whats up now"

The only difference is that eval() will work on an array in the second example, and that ends up with a blank string instead of "whats up now". It also returns @error 1

$something[0] contains the number of elements in the array, you can't use [0].

Share this post


Link to post
Share on other sites

I recommend you tidy-up your script a little and look through it again.

I find that when ever something does not work, i tidy it up, then look through it line by line, in order of execution, and usually find what i am doing wrong.

Hope this helps...

#)

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  
Followers 0