litlmike Posted May 12, 2006 Share Posted May 12, 2006 1) Credit to big_daddy for help on this previously, he made 99.9% of this script. 2) How do I change the script so that the GUI will display all columns of the info in the table? 2a) Is that more of a GUI question, or a IE.au3 question? 3) Dumb question, is $i predefined somewhere? 4) Thanks in Advance. expandcollapse popup#include <IE_T2[1][1].0_0.au3> #include <GUIConstants.au3> #Include <GuiListView.au3> #include <GuiStatusBar.au3> $Form1 = GUICreate("Hong Kong Observatory", 620, 440, 200, 125) $List1 = GUICtrlCreateListView("Place|Temp|A|B|C|D|E|F|G|H", 5, 35, 610, 365) $Button1 = GUICtrlCreateButton("GO", 5, 10, 33, 21, $BS_DEFPUSHBUTTON) $StatusBar1 = _GuiCtrlStatusBarCreate ($Form1, 620, "", $SBT_TOOLTIPS) _GuiCtrlStatusBarSetMinHeight ($StatusBar1, 35) _GuiCtrlStatusBarSetText ($StatusBar1, ' Click the "GO" button.') $Progress1 = GUICtrlCreateProgress(410, 412, 200, 20) GUICtrlSetResizing($Progress1, $GUI_DOCKSTATEBAR) GUICtrlSetState($Progress1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 _GUICtrlListViewDeleteAllItems ($List1) _GuiCtrlStatusBarSetText ($StatusBar1, ' Gathering data, Please Wait....') GUICtrlSetData($Progress1, 0) GUICtrlSetState($Progress1, $GUI_SHOW) Ping("www.google.com") If @error Then MsgBox(0, "Connection Error!", "There was a problem connecting to the internet.") _GuiCtrlStatusBarSetText ($StatusBar1, ' Check you internet connection and try again.') ContinueLoop EndIf $oIE = _IECreate (0) GUICtrlSetData($Progress1, 10) _IENavigate ($oIE, "http://www.footballoutsiders.com/stats/te.php") GUICtrlSetData($Progress1, 20) ; Get a reference to the second table on the webpage (where the data is stored) $oTable = _IETableGetCollection ($oIE, 2) GUICtrlSetData($Progress1, 70) ; Read the table cells into a 2-D array $aProfile = _IETableWriteToArray ($oTable) GUICtrlSetData($Progress1, 80) _IEQuit ($oIE) GUICtrlSetData($Progress1, 90) ; Write the array contents to the listview For $i = 0 To UBound($aProfile, 0) - 1; For $i = 0 To UBound($aProfile, 2) - 1 If $aProfile[0][$i] == 0 Then ContinueLoop Local $lv_item = GUICtrlCreateListViewItem($aProfile[0][$i] & "|" & $aProfile[1][$i] , $List1) Next GUICtrlSetData($Progress1, 100) _GUICtrlListViewSetColumnWidth ($List1, 0, $LVSCW_AUTOSIZE) _GUICtrlListViewSetColumnWidth ($List1, 1, $LVSCW_AUTOSIZE_USEHEADER) _GuiCtrlStatusBarSetText ($StatusBar1, ' Reading data complete.') GUICtrlSetState($Progress1, $GUI_HIDE) EndSelect WEnd Exit _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 12, 2006 Moderators Share Posted May 12, 2006 1) Credit to big_daddy for help on this previously, he made 99.9% of this script. 2) How do I change the script so that the GUI will display all columns of the info in the table? 2a) Is that more of a GUI question, or a IE.au3 question? 3) Dumb question, is $i predefined somewhere? 4) Thanks in Advance.$i is typically used as an integer in For Loops, you can reference it within the loop like I did in this script. I'm not the best at explaining things like this, if you still have questions maybe someone more informed than me can help you. Try this out: expandcollapse popup#include <IE_T2[1][1].0_0.au3> #include <GUIConstants.au3> #Include <GuiListView.au3> #include <GuiStatusBar.au3> $Form1 = GUICreate("TIGHT ENDS 2005", 620, 440, 200, 125) $List1 = GUICtrlCreateListView("Player|Team|DPAR|DPAR Rank|PAR|PAR Rank|" & _ "DVOA|DVOA Rank|VOA|Passes|Yards|TD|Catch %", 5, 35, 610, 365) $Button1 = GUICtrlCreateButton("GO", 5, 10, 33, 21, $BS_DEFPUSHBUTTON) $StatusBar1 = _GuiCtrlStatusBarCreate($Form1, 620, "", $SBT_TOOLTIPS) _GuiCtrlStatusBarSetMinHeight($StatusBar1, 35) _GuiCtrlStatusBarSetText($StatusBar1, ' Click the "GO" button.') $Progress1 = GUICtrlCreateProgress(410, 412, 200, 20) GUICtrlSetResizing($Progress1, $GUI_DOCKSTATEBAR) GUICtrlSetState($Progress1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 _GUICtrlListViewDeleteAllItems($List1) _GuiCtrlStatusBarSetText($StatusBar1, ' Gathering data, Please Wait....') GUICtrlSetData($Progress1, 0) GUICtrlSetState($Progress1, $GUI_SHOW) Ping("www.google.com") If @error Then MsgBox(0, "Connection Error!", "There was a problem connecting to the internet.") _GuiCtrlStatusBarSetText($StatusBar1, ' Check you internet connection and try again.') ContinueLoop EndIf $oIE = _IECreate (0) GUICtrlSetData($Progress1, 10) _IENavigate ($oIE, "http://www.footballoutsiders.com/stats/te.php") GUICtrlSetData($Progress1, 20) ; Get a reference to the second table on the webpage (where the data is stored) $oTable = _IETableGetCollection ($oIE, 2) GUICtrlSetData($Progress1, 70) ; Read the table cells into a 2-D array $aProfile = _IETableWriteToArray ($oTable) GUICtrlSetData($Progress1, 80) _IEQuit ($oIE) GUICtrlSetData($Progress1, 90) ; Write the array contents to the listview For $i = 0 To UBound($aProfile, 2) - 1 If $aProfile[0][$i] == "Player" Then ContinueLoop Local $lv_item = GUICtrlCreateListViewItem($aProfile[0][$i] & "|" & $aProfile[1][$i] & _ "|" & $aProfile[2][$i] & "|" & $aProfile[3][$i] & "|" & $aProfile[4][$i] & "|" & _ $aProfile[5][$i] & "|" & $aProfile[6][$i] & "|" & $aProfile[7][$i] & "|" & $aProfile[8][$i] & _ "|" & $aProfile[9][$i] & "|" & $aProfile[10][$i] & "|" & $aProfile[11][$i] & "|" & $aProfile[12][$i], $List1) Next GUICtrlSetData($Progress1, 100) _GUICtrlListViewSetColumnWidth($List1, 0, $LVSCW_AUTOSIZE) _GUICtrlListViewSetColumnWidth($List1, 1, $LVSCW_AUTOSIZE_USEHEADER) _GuiCtrlStatusBarSetText($StatusBar1, ' Reading data complete.') GUICtrlSetState($Progress1, $GUI_HIDE) EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
litlmike Posted May 12, 2006 Author Share Posted May 12, 2006 $i is typically used as an integer in For Loops, you can reference it within the loop like I did in this script. I'm not the best at explaining things like this, if you still have questions maybe someone more informed than me can help you. Thanks! Ha!-more informed than you? So modest. Is $i some sort of global variable? Will I ever have to define it when using in a For loop? Like: $i = 0 For $i = 0 To ... Or Can I just write? For $i = 0 _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 12, 2006 Moderators Share Posted May 12, 2006 Thanks! Ha!-more informed than you? So modest. Is $i some sort of global variable? Will I ever have to define it when using in a For loop? Like: $i = 0 For $i = 0 To ... Or Can I just write? For $i = 0What do you think your doing when you state For $i = ? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
litlmike Posted May 12, 2006 Author Share Posted May 12, 2006 What do you think your doing when you state For $i = ?I was thinking that it is communicating that whenever this condition is true $i = 0, then do the following. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 12, 2006 Moderators Share Posted May 12, 2006 I was thinking that it is communicating that whenever this condition is true $i = 0, then do the following.Run this and see if it answers your question on what "=" does in that situation:Global $i = 545 MsgBox(0, "Example 1", $i, 2) For $i = 1 To 1 MsgBox(0, "Example 2", $i, 2) Next Dim $i = "Apple" MsgBox(0, "Example 3", $i, 2) For $i = 1 To 2 MsgBox(0, "Example 4", $i, 2) Next Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now