Jump to content

Special concatenation


Recommended Posts

Hi,

I have a problem, I need to do a special concatenation, I need to create an array like this:

$var= "text"

dim $ & $var & [3]

I need an array named text => dim $text[3] but I don't know how to do that... Can you help me ?

PS: Sorry for my english, I'm french.

Link to comment
Share on other sites

I am no pro with AutoIt, but I really don't think it is possible to create variable names during runtime. From the manual:

"Each variable has a name (again, similar to a mailbox) and must start with the $ character and may only contain letters, numbers and the underscore _ character"

No mention of other variables, so I don't think you can do it.

aarnott

Link to comment
Share on other sites

Ah, now i understand what you mean. You want to create a dynamic-name variable, right?

I guess its not possible, because its not in most languages. Only script language i know which supports dynamic variable names is mIRCs scripting.

Im not sure here either.

Link to comment
Share on other sites

You can, or alteast you could, do it in perl, but thats not the point. The closest thing in AutoIt is Eval(), but that will not do what you want it to do, so for now you are SOL.

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
Share on other sites

Actually its really simple

#include <array.au3>
$var= "text"
Assign ( $var, _ArrayCreate ( "", "", "" ) )

edit: the max size of an array declared like this is 27.

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

Thanks but my problem is i need the name of the array to add elements:

$sections = IniReadSectionNames ("config.ini")

For $i = 1 To $sections[0]
    $sectioni = IniReadSection("config.ini", $sections[$i])
    $title=$sections[$i]
      Assign ( $sections[$i], _ArrayCreate ("") )
    For $j = 1 To $sectioni[0][0]
           $z = $sectioni[$j][0]
        _ArrayAdd( $Eval($sections[$i]), $z);here!!
    Next
Next
Edited by Makkhdyn
Link to comment
Share on other sites

Have you considered a 3-D array? I think this might be what you are asking:

$sections = IniReadSectionNames ("config.ini")

For $i = 1 To $sections[0]
    $section[$i] = IniReadSection("config.ini", $sections[$i])
    $title=$sections[$i]
      Assign ( $sections[$i], _ArrayCreate ("") )
    For $j = 1 To $section[$i][0][0]
           $z = $section[$i][$j][0]
        _ArrayAdd( $Eval($sections[$i]), $z);here!!
    Next
Next

That should have the same effect as what you were asking. But maybe I don't understand the question after all.

Link to comment
Share on other sites

  • 2 weeks later...

salut je parle francais je crois bien avoir compris se que tu veux dire et c'est impossible tu ne peux pas mettre variable le nom d'une variable mais peu-etre si tu me disais pourquoi je pourais t'aider plus bye bye

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

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