Jump to content

Help with array

Recommended Posts

Ok I am having a problem with the function below. I need to check that a link exists on a web page and that it is the first link in the frame.

Here is an example of what the link might look like:


Since the security code always changed I cannot just match it. So I need to cut it up in an array but if the link does not exists it errors out saying that the array is out of range. Any ideas


   Dim $ADD_SUB[10]
   Dim $ADD[2]
   While $j < 5
      MOVETO($MAIN);A function that activates a frame and does some other stuff
      Send ("{TAB 3}");this tabs top the first link in the frame
      $ADD_LINK = StatusbarGetText($TITLE)
      $ADD_SUB = StringSplit($ADD_LINK, "/")
      $ADD = StringSplit($ADD_SUB[9], ".")
      If $ADD[1] = "PrimaryRecordPage" Then Exitloop
   If $ADD[1] <> "PrimaryRecordPage" Then
      MsgBox(262144, "Error", "Error, you must be on the " & $ADD[1])
Edited by zasxes
Link to comment
Share on other sites

Why not test to make sure the array has 9 elements (or however many it has when you get the proper URL selected) ? Only attempt to access the 9th element if and when the proper number of elements exist. In the code snippet below, I have assumed that you are waiting unti the result of the stringsplit is excatally 9 seperate strings. Adjust it accordingly. My example code is designed to go above your $ADD = StringSplit($ADD_SUB[9], ".") line:

If $ADD_SUB[0] = 9 Then ;test to make sure the proper elements are in the string
  $ADD = StringSplit($ADD_SUB[9], ".")
 ;do something to handle the case of an invalid selection

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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

  • Recently Browsing   0 members

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