Jump to content

Variable question?


Recommended Posts

No you cannot do what you are trying to do but you can create a array and use one variable in another

$count = 1
$var[$count] = 500

so $var[0] = 1 and $var[1] = 500 if you had $count = 2 the thing would fail because you never included $var[1] then unless you enum it.

Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Link to comment
Share on other sites

No you cannot do what you are trying to do but you can create a array and use one variable in another

$count = 1
$var[$count] = 500

so $var[0] = 1 and $var[1] = 500 if you had $count = 2 the thing would fail because you never included $var[1] then unless you enum it.

Well, it can be done:
$count = 1
Assign("var" & $count, 500)
ConsoleWrite("Debug: $var1 = " & Eval("var1") & @LF)

But, you are right that in the vast majority of cases, arrays are much better.

Assign/Eval are, almost always, evil.

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 1 month later...

Well, I need to read from ini-file the several number of sections into arrays. Do the following:

#include <Array.au3>
$IniGeneral = IniReadSection("champ.ini", "General")
If @error Then 
    MsgBox(4096, "", "Error occurred, probably no INI file.")
 EndIf
 
For $g = 1 to $IniGeneral[_ArraySearch ($IniGeneral, "GroupQuan")][1]
    Assign ("IniGroup" & $g, IniReadSection ("champ.ini", "Group" & $g))
Next; that works fine; I get, for example, 2 arrays named $IniGroup1, $IniGroup2

; now I want to see them
For $g = 1 to $IniGeneral[_ArraySearch ($IniGeneral, "GroupQuan")][1]
    _ArrayDisplay (Eval("IniGroup" & "g"))
Next; that doesn't work

example of champ.ini

[General]
ShowLogo=1
TopicNum=1000
PeriodsQuan=20
EstablishConn=0
DeleteConn=1
ConnName=
MultiGame=0
MultiGamePath=
GroupQuan=2
GroupName=Group
[Group1]
GroupEmail=1lalala@unknown.ru
GroupEmailPass=1qwertyuiop
GroupEmailLogin=1tototo
GroupEmailPOP=1poppopop
GroupEmailSMTP=1smtpsmtp
[Group2]
GroupEmail=2lalala@unknown.ru
GroupEmailPass=2qwertyuiop
GroupEmailLogin=2tototo
GroupEmailPOP=2poppopop
GroupEmailSMTP=2smtpsmtp

Can you help with this? (I am newbie) And sorry for bad English

Edited by Tipulatoid
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...