Sign in to follow this  
Followers 0
shawtayee

Array to GUI

18 posts in this topic

I actually want to display an Array (with 5x10 size) which I get via _IETableWriteToArray to display in my GUI.

Could somebody maybe help me? I am very new to programmin and AutoIt =\

Share this post


Link to post
Share on other sites



where do you want to display it? or just display by _ArrayDisplay($array)?


UnderWorldVN- Just play the way you like it

Share this post


Link to post
Share on other sites

I want to display it in my GUI with GUICtrlCreateLabel or another command, if there is any better :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

[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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

I already tried it with "-1" and I just missed to copy the "endif" I dont know why this isnt working, god damn it

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

you should at least tell us where the error comes from

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I think the problem it's this:

_IENavigate($oIE, "java script:get_playerlist()")

replace it with :

_IEAction ($oIE, "refresh")

off topic: I was a dota player too :)

Share this post


Link to post
Share on other sites

Okay now he is actually doing the "else" instead of just giving me the msgbox xD guess whatever the return is, it is not -1 :)

OT: :DD nice to hear =D why U stopped?

Share this post


Link to post
Share on other sites

ARGH I AM SO STUPID >_> _ArraySearch is supposed to return 6 if nothing is found, thanks guys

Share this post


Link to post
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 :)

Share this post


Link to post
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???

Share this post


Link to post
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
Sign in to follow this  
Followers 0