Jump to content

Recommended Posts

Oops, yeah. I caught that after I made the post but I forgot to edit it. That isn't my problem though. I still need a separate array for each show. The code as it is now, overwrites the array each time through the loop.

Use a 2D array:
#include <Array.au3>
#include <Inet.au3>

; 2D array of shows:
;   [n][0] = URL
;   [n][1] = source
Local $show[13][2] = [["", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=24", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=Bones", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=CriminalMinds", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=CSI", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=CSIMiami", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=CSINewYork", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=Flashpoint", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=House", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=LietoMe", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=Mythbusters", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=NCIS", ""], _
["http://services.tvrage.com/tools/quickinfo.php?show=Numb3rs", ""]]

; Get sources
For $X = 1 To UBound($show) - 1
    $show[$X][1] = _INetGetSource($show[$X][0])
Next

; Display sources
For $X = 1 to UBound($show) - 1
    $avSplit = StringSplit($show[$X][1], @LF)
    _ArrayDisplay($avSplit, "Show: " & $X)
Next

:)

Edit: Oops... Put missing delimiter in StringSplit().

Edited by PsaltyDS
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

Arrays don't work that way in AutoIt.

You have to fully qualify any reference to an array, specifying values for all dimensions.

In some other languages you can omit indexes in your reference and have a group field to move, display or manipulate.

But, here, your array defined as $data[$x][$y] can never be referenced as simply $data[$x].

I'm used to COBOL (don't pick on me!) and I do miss the ability to easily build more complex data structures and manipulate fields on a group level.

Edit: Not that I'm complaining! <ducking and glancing upward for any ominous lightning-producing clouds>

Edited by Spiff59
Link to comment
Share on other sites

$info is only a one-dimension array, so $info[1] references the lowest dimension, the dimension that actually contains data.

$data is a two-dimension array and you haven't provided enough information to retrieve the data element.

For a two or more dimension array (in Autoit) such as $data[$x][$y], the $x dimension is just a multiplier for organizing occurances of the last ($y) level where the data resides. I think behind the scenes everything is really a one-dimension array, so if you declare an array as $data[10][20], then when referencing $data[5][15] it's just converted through some formula like (5-1)*20 + 15 = 95 and grabs the 95th occurance. So (in Autoit) you cant really think of the higher dimensions in the array as "containing" anything.

Edit: Rereading this, my "behind the scenes" comment seems rather stupid. Technically, behind the scenes, *everything* boils down to a one-dimension array, or flat file, or list, regardless or what language or database. It's just the manner in which it is collected/presented/referenced at the application level that varies. I'm getting mush-brained, better hit the sack...

Edited by Spiff59
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...