Jump to content

Array to GUI


Recommended Posts

Well, that my UI looks something like this

______________________

| |

| |_| |_| |_| |_| |_| |

| |_| |_| |_| |_| |_| |

| |_| |_| |_| |_| |_| |

| |

| |button1| |button2| |

| |

| |

|_____________________|

while the "array" (5x3 in this example) will be numbers, names and so on

/edit: argh sry it messes it up totally, hope u still understand what I mean

Edited by shawtayee
Link to comment
Share on other sites

How about something like

$array[3][5]

$11 = GUICtrlCreateEdit($array[1][1], coordinate x1, coordinate y1, coordinate x2, coordinate y2)
$12 = GUICtrlCreateEdit($array[1][2], coordinate x1, coordinate y1, coordinate x2, coordinate y2)
$13 = GUICtrlCreateEdit($array[1][3], coordinate x1, coordinate y1, coordinate x2, coordinate y2)
$14 = GUICtrlCreateEdit($array[1][4], coordinate x1, coordinate y1, coordinate x2, coordinate y2)
$15 = GUICtrlCreateEdit($array[1][5], coordinate x1, coordinate y1, coordinate x2, coordinate y2)
$21 = GUICtrlCreateEdit($array[2][1], coordinate x1, coordinate y1, coordinate x2, coordinate y2)

I'm still new to GUIs

Edited by Roman9
Link to comment
Share on other sites

[3,5] Hope it works

#include <array.au3>

HotKeySet("{ESC}","_Exit")

Local $L[20]
$F = GUICreate("",400,400,-1,-1)
For $i = 1 to 5
    $L[$i] = GUICtrlCreateLabel("label" & $i,$i*50,20,40,15)
    $L[$i+5] = GUICtrlCreateLabel("label" & $i + 5,$i*50,60,40,15)
    $L[$i+10] = GUICtrlCreateLabel("label" & $i + 10,$i*50,100,40,15)
Next

$IEArray = _IETableWriteToArray($IEobject)

For $J = 0 to 4
    GUICtrlSetData($L[$j +1],$IEArray[1][$j])
    GUICtrlSetData($L[$j +6],$IEArray[2][$j])
    GUICtrlSetData($L[$j +11],$IEArray[3][$j])
Next
   
GUISetState(@SW_SHOW)


While 1
        Sleep(100)
WEnd

Func _Exit()
    Exit
EndFunc
Edited by nguyenbason
UnderWorldVN- Just play the way you like it
Link to comment
Share on other sites

ty, that helped me alot, got another question

$oTable = _IETableGetCollection ($oIE, 1)
        $avArray = _IETableWriteToArray ($oTable, True)
        $check4feed = _ArraySearch($avArray, "BLA BLA BLA")
        If $check4feed = @error Then 
            MsgBox(4096, "test", "FAIL")

is there something wrong with this? He just wont open the msg box, even if no bla bla bla is found in $avArray

Edited by shawtayee
Link to comment
Share on other sites

1)on failure $check4feed is set to -1 and @error to 1 or 2 or 3 etc... so that comparison will be never true

2) there is a missing endif

3)you can either do:

If $check4feed = -1 Then 
            MsgBox(4096, "test", "FAIL")
endif

or

If @error Then 
            MsgBox(4096, "test", "FAIL")
endif
Edited by oMBRa
Link to comment
Share on other sites

ty, that helped me alot, got another question

$oTable = _IETableGetCollection ($oIE, 1)
          $avArray = _IETableWriteToArray ($oTable, True)
          $check4feed = _ArraySearch($avArray, "BLA BLA BLA")
          If $check4feed = @error Then 
              MsgBox(4096, "test", "FAIL")

is there something wrong with this? He just wont open the msg box, even if no bla bla bla is found in $avArray

_ArraySearch returns the index but if it fails it sets the global variable @error to a value which lets you know what the problem was. (The help is not quite clear on this to me.) It doesn't set the return to the same value that it sets @error. If there is no error then @error will be 0 so you will only see a message box if there is no error and the index found is 0.

So you need something like

If $check4feed = -1 Then 
             MsgBox(4096, "test", "FAIL, @error = " & @error )
 EndIf
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

#include <IE.au3>
#include <Array.au3>

$oIE = _IECreate("http://www.dota-league.com/?section=instant/instant_single_game", "", 1)
    _IENavigate($oIE, "java script:get_playerlist()")
        $oTable = _IETableGetCollection ($oIE, 1)
        $avArray = _IETableWriteToArray ($oTable, True)
        $check4feed = _ArraySearch($avArray, "cr3w.shawtayee")
        If $check4feed = -1 Then 
            MsgBox(4096, "test", "FAIL")
        EndIf

here is the part that I am talking about, just wont get it working

Link to comment
Share on other sites

In the code above, the program should create an IE window, refresh the important frame via " _IENavigate($oIE, "java script:get_playerlist()")"

then get the table from IE to an array and search for "cr3w.shawtayee" which in this case, won't be found and becuz of that, should open a msgbox if I am not totally mistaken

Link to comment
Share on other sites

_ArraySearch returns the index but if it fails it sets the global variable @error to a value which lets you know what the problem was. (The help is not quite clear on this to me.) It doesn't set the return to the same value that it sets @error. If there is no error then @error will be 0 so you will only see a message box if there is no error and the index found is 0.

So you need something like

If $check4feed = -1 Then 
             MsgBox(4096, "test", "FAIL, @error = " & @error )
 EndIf
you actually explained everything, 0 is the key, thank you guy :)
Link to comment
Share on other sites

Sorry but I need help again I will give you a code now, so you test on urself...

#include <IE.au3>
#include <Array.au3>

$oIE = _IECreate("http://www.dota-league.com/?section=instant/instant_single_game", "", 1)
        $oTable = _IETableGetCollection ($oIE, 1)
        $avArray = _IETableWriteToArray ($oTable, True)
        $check4feed = _ArraySearch($avArray, "cr3w.shawtayee")
        _ArrayDisplay($avArray)

If "cr3w.shawtayee" is in the table or not, $check4feed is always 0... why???

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