Sign in to follow this  
Followers 0
c4mpi

array to GuiCtrlsetdata

8 posts in this topic

I want to take information from a table on a page

WinActivate("Random")
$oIE = _IEAttach("Random")
$oFrameBB2 = _IEFrameGetObjByName($oIE, "middle")
$oTable = _IETableGetCollection ($oFrameBB2, 7)
$aTableData = _IETableWriteToArray ($oTable, True)
_ArrayDisplay($aTableData)

This is what I get

[0]|text

[1]|23%

How Can I use this information for

GuiCtrlsetdata ?

Share this post


Link to post
Share on other sites



Like this:

GuiCtrlSetData($idCtrl_1, $aTableData[0])
GuiCtrlSetData($idCtrl_2, $aTableData[1])

Of course, you need to ID your control IDs in $idCtrl_1 and $idCtrl_2.

:(


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

Share this post


Link to post
Share on other sites

Like this:

GuiCtrlSetData($idCtrl_1, $aTableData[0])
GuiCtrlSetData($idCtrl_2, $aTableData[1])

Of course, you need to ID your control IDs in $idCtrl_1 and $idCtrl_2.

:(

What id :)

Share this post


Link to post
Share on other sites

What id :)

You asked about GuiCtrlSetData(). How did you intend to identify the control to which the data was to be set?

Did you look at GuiCtrlSetData() in the help file?

:(


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

Share this post


Link to post
Share on other sites

You asked about GuiCtrlSetData(). How did you intend to identify the control to which the data was to be set?

Did you look at GuiCtrlSetData() in the help file?

:)

Oh, that Id :(

Well thanks :)

Share this post


Link to post
Share on other sites

#include <IE.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 445, 192, 124)
$Label1 = GUICtrlCreateLabel("Label1", 104, 104, 36, 17)
$Label2 = GUICtrlCreateLabel("Label2", 96, 136, 36, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

EndSwitch
WinActivate("anyinternetpage")
$oIE = _IEAttach("anyinternetpage")
$oFrameBB2 = _IEFrameGetObjByName($oIE, "middle")
$oTable = _IETableGetCollection ($oFrameBB2, 7)
$aTableData = _IETableWriteToArray ($oTable, True)
GuiCtrlSetData($Label2, $aTableData[1])
WEnd

I get this error

:\Users\mort1\Desktop\Nytt AutoIt v3 Script (10).au3 (36) : ==> Subscript used with non-Array variable.:

GuiCtrlSetData($Label2, $aTableData[1])

GuiCtrlSetData($Label2, $aTableData^ ERROR

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

So $aTableData is not an array, therefore _IETableWriteToArray() failed, perhaps because of earlier problems. Do some error checking after each of your _IE* functions to verify they succeeded before going on to the next one. Put _IEErrorHandlerRegister() near the top and run it in SciTE to see the console output for more debug information.

:(

P.S. The table should produce a 2D array, but you only have one subscript. What do you get for Ubound($aTableData, 0)?

:)

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

Share this post


Link to post
Share on other sites

So $aTableData is not an array, therefore _IETableWriteToArray() failed, perhaps because of earlier problems. Do some error checking after each of your _IE* functions to verify they succeeded before going on to the next one. Put _IEErrorHandlerRegister() near the top and run it in SciTE to see the console output for more debug information.

:)

P.S. The table should produce a 2D array, but you only have one subscript. What do you get for Ubound($aTableData, 0)?

:)

I managed to fix this error, the reason was that it attached to the wrong window :(

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