Jump to content

What am I doing wrong?!


Recommended Posts

Firstly I've declared the array globaly... (I've also tried not declaring it etc)

$arr = _IETableWriteToArray($tablesss)                      ; Read the table to the array (yes $tablesss is declared earlier
        $loc = _ArraySearch($arr, "Översikter", 0, Ubound($arr), 0, 1); This actually finds this in the array (but only when it actually exists
        If NOT @Error Then                              ; Check if the above succeded
            _ArrayDisplay($arr)                         ; This displays that the array contains 4 rows of text (0, 1, 2, 3)
;~          $resstring = $arr[1]                            ; This crashes the entire script and I have no idea why because of the above...
            msgbox(0, "", _ArrayToString($arr, @tab, 0, 3))     ; Displays NOTHING :'(
;~          MsgBox(0, "", @error)                           ; Error is 0
            msgbox(0, "", _ArrayPop($arr) & @crlf & _ArrayPop($arr) & @crlf & _ArrayPop($arr) & @crlf & _ArrayPop($arr)); Should display atleast something but no... Nothing here either
;~          MsgBox(0, "", @error)                           ; Error is 0

Please help what am I doing wrong?!

Edited by Azothoras
Link to comment
Share on other sites

  • Moderators

Azothoras,

If I set $arr manually to a 4 line text array everything works for me:

#include <Array.au3>

;$arr = _IETableWriteToArray($tablesss); Read the table to the array (yes $tablesss is declared earlier
Global $arr[4] = ["Zero", "Översikter", "Two", "Three"]

$loc = _ArraySearch($arr, "Översikter", 0, UBound($arr), 0, 1); This actually finds this in the array (but only when it actually exists
ConsoleWrite($loc & @CRLF)
If Not @error Then; Check if the above succeded
    _ArrayDisplay($arr); This displays that the array contains 4 rows of text (0, 1, 2, 3)
;~           $resstring = $arr[1]                          ; This crashes the entire script and I have no idea why because of the above...
    MsgBox(0, "", _ArrayToString($arr, @TAB, 0, 3)); Displays NOTHING :'(
;~           MsgBox(0, "", @error)                         ; Error is 0
    MsgBox(0, "", _ArrayPop($arr) & @CRLF & _ArrayPop($arr) & @CRLF & _ArrayPop($arr) & @CRLF & _ArrayPop($arr)); Should display atleast something but no... Nothing here either
;~           MsgBox(0, "", @error)                         ; Error is 0
EndIf

What error message does SciTE give you when you try to use _ArrayDisplay and the script crashes? What return value do you get if you use _IsArray($arr)?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Ty for replies... I am such a noob ;)

Did a test to see if the array had more than one dimension (Didn't show in _ArrayDisplay but I tested anyway) and as it turned out it had two dimension... lol 1 was hidden... wtf?

Got a new problem now though...

D:\Program\AutoIt3\Include\IE.au3 (2157) : ==> The requested action with this object has failed.:
$i_col = $i_col + $td.colSpan
$i_col = $i_col + $td.colSpan^ ERROR

Seems like the IE.au3 causes the error... (I get this error randomly not all the time)

Sometimes within 2 seconds of the script and sometimes it can run for 30 minutes... ^_^

Edited by Azothoras
Link to comment
Share on other sites

Ty for replies... I am such a noob :(

Did a test to see if the array had more than one dimension (Didn't show in _ArrayDisplay but I tested anyway) and as it turned out it had two dimension... lol 1 was hidden... wtf?

Got a new problem now though...

D:\Program\AutoIt3\Include\IE.au3 (2157) : ==> The requested action with this object has failed.:
$i_col = $i_col + $td.colSpan
$i_col = $i_col + $td.colSpan^ ERROR

Seems like the IE.au3 causes the error... (I get this error randomly not all the time)

Sometimes within 2 seconds of the script and sometimes it can run for 30 minutes... ;)

_IETableWriteToArray() always returns a 2D array unless it fails (returns 0). If there is only one column it may look like a 1D array in _ArrayDisplay(), but every reference would have to have [n][0] vice just [n]. When you already know there will only be one column (or you are only interested in the first column regardless) you can hard code for [n][0] in your references.

Add _IEErrorHandlerRegister() near the top of your script and run it from SciTE to get fuller debug information.

^_^

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