Jump to content

Structures


Recommended Posts

Hi, I am trying to do a script that could really use structures/ objects /somthing to organise it better. So far the only thing I have been using are arrays but they arn't really suited to this problem. I can only find that DLL struct function which doesn't seem like its supposed to be used as a proper datastructure for use in autoit scripts. Is there such a thing or do I have to make do with arrays?

Link to comment
Share on other sites

Hi, I am trying to do a script that could really use structures/ objects /somthing to organise it better. So far the only thing I have been using are arrays but they arn't really suited to this problem. I can only find that DLL struct function which doesn't seem like its supposed to be used as a proper datastructure for use in autoit scripts. Is there such a thing or do I have to make do with arrays?

see this post of me: http://www.autoitscript.com/forum/index.ph...mp;#entry273339

I don't know if this still works, so you might just try ....

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Well is it possible to access elements of an array thats inside another array?

Somthing like this maybe:

DIM $parent[1]
DIM $child[2]

$parent[0] = $child
$child[0] = "Hello "
$child[1] = "world"

msgbox(0, "Example", $parent[0][0] & $parent[0][1])

Ovbiously that errors because it is trying to access the 2nd dimension in an array with only 1 dimension, but what I am trying to do is access things in the first dimension of the array pointed to by $parent[0].

Link to comment
Share on other sites

Well is it possible to access elements of an array thats inside another array?

Ovbiously that errors because it is trying to access the 2nd dimension in an array with only 1 dimension, but what I am trying to do is access things in the first dimension of the array pointed to by $parent[0].

Notice what happens here:

DIM $parent[1]
DIM $child[2]

$parent[0] = $child
$child[0] = "Hello "
$child[1] = "world"

$test = $parent[0]

msgbox(0, "Examples", "Example of $child: " & $child[0] & $child[1] & @CRLF & _
        "Example of $test: " & $test[0] & $test[1])oÝ÷ ÙhZ¶
²)í£Mú¥ªÞÝ"± =¶´ß§!WZ®¶²Â¬Úç¬ÉëR£^*.+ÞÛÚç¬iû^­Ê)Ê)àÛhÓ~©j·§·Ka{'hm²0º§Ó~­zËM£kÊ+m+0k&®¶­sdDÒb33c·&VçE³Ð¤DÒb33c¶6ÆE³%ÒÒ²gV÷C´VÆÆògV÷C²ÂgV÷C·v÷&ÆBgV÷CµÐ ¢b33c·&VçE³ÒÒb33c¶6Æ@¢b33c¶6ÆE³ÒÒgV÷C´vööF'RgV÷C°¢b33c¶6ÆE³ÒÒgV÷C·V÷ÆRgV÷C° ¢b33c·FW7BÒb33c·&VçE³Ð ¦×6v&÷ÂgV÷C´W×ÆW2gV÷C²ÂgV÷C´W×ÆRöbb33c¶6ÆC¢gV÷C²fײb33c¶6ÆE³Òfײb33c¶6ÆE³Òfײ5$Äbfײð gV÷C´W×ÆRöbb33c·FW7C¢gV÷C²fײb33c·FW7E³Òfײb33c·FW7E³Ò

What goes into $parent[0] is not a pointer to the $child array, just a copy of the array. While those $child elements are in $parent[0] you cannot access them individually. You have to copy that array out from $parent[0] to $test beforehand.

:)

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

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