Ebenezer Posted April 9, 2006 Posted April 9, 2006 I have this little piece of code. It pulls data from an webpage (this works fine) and compares it to the content of the listview. If there is already an entry like that it should increase the value, otherwise it should create a new entry.Now when i execute the code with a debugging messagebox, everything runs fine:expandcollapse popupFunc GetInventory() Toggle_Images_Off(1) $o_IE = _IECreate (0) _IENavigate ($o_IE, "***") Global $InventoryContent_Name[1] = [""] Global $InventoryContent_Number[1] = [""] Do $vText = _IEBodyReadHTML($o_IE) ;Holt Seiteninhalt If StringLen($vText) < 400 OR StringInStr($vText, "neopets") = 0 Then _IEAction($o_IE, "refresh") Until StringLen($vText) >= 400 ;Liste erstellen $j = 0 For $i = 1 To NumberOfResults($vText, $Inventory_Startstring_Items) $vTemp = 0 $vItem = SucheBegriff($vText, $i, $Inventory_Startstring_Items, $Inventory_Endstring_Items) While NOT $j <= 0 $vTest = _GUICtrlListViewGetItemText($Inventory_Listview, ($j-1), 0) If $vTest = $vItem Then;Item vorhanden MsgBox(0, "", "") _GUICtrlListViewSetItemText($Inventory_Listview, ($j-1), 1, (_GUICtrlListViewGetItemText($Inventory_Listview, ($j-1), 1)+1)) $vTemp = 1 EndIf $j = $j - 1 WEnd If $vTemp = 0 Then GUICtrlCreateListViewItem ($vItem & "|1", $Inventory_Listview) EndIf $j = _GUICtrlListViewGetItemCount($Inventory_Listview) ;~ Sleep(2000) MsgBox(0, "Listenlänge", $j) Next Toggle_Images_Off(0) _IEAction($o_IE, "quit") EndFuncIf I remove the Msgbox and insert a sleep command (to make sure it's not an timing issue) the comparison seems to fail.Could anyone point me in the right direction? I'm somewhat stumped here Thanks.
GaryFrost Posted April 9, 2006 Posted April 9, 2006 try adding the window title of the gui to the get and set. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Ebenezer Posted April 9, 2006 Author Posted April 9, 2006 Added "MyGUI" to the _GUICtrlListViewGetItemText. No changes so far. I can't see a place to add a windowtitle to the _GUICtrlListViewSetItemText function though. The only modifiers listed in the helpfile are "$h_listview, $i_index, $i_subitem, $s_text" Thanks again for your time.
Ebenezer Posted April 9, 2006 Author Posted April 9, 2006 Hmm - this was a tad too hasty. Argh, how stupid can one person be ???_GUICtrlListViewSetItemText expects a string.For future boneheads: a simple$Value = String((_GUICtrlListViewGetItemText($Inventory_Listview, ($j-1), 1))+1)_GUICtrlListViewSetItemText($Inventory_Listview, ($j-1), 1, $Value)did the trick. Thanks again to everyone.<shakes head> reading can be SO hard sometimes crying.gifI seem to have narrowed it down a bit. Seems, the error occurs when the GUI does not have focus. Is there any way around this? The initial data query can take up to 4 minutes. It seems to be somewhat sloppy to have the users stare at the screen during this just to avoid losing focus.
nfwu Posted April 12, 2006 Posted April 12, 2006 expandcollapse popupFunc GetInventory() Toggle_Images_Off(1) $o_IE = _IECreate (0) _IENavigate ($o_IE, "***") Global $InventoryContent_Name[1] = [""] Global $InventoryContent_Number[1] = [""] Do $vText = _IEBodyReadHTML($o_IE) ;Holt Seiteninhalt If StringLen($vText) < 400 OR StringInStr($vText, "neopets") = 0 Then _IEAction($o_IE, "refresh") Until StringLen($vText) >= 400 ;Liste erstellen $j = 0 For $i = 1 To NumberOfResults($vText, $Inventory_Startstring_Items) $vTemp = 0 $vItem = SucheBegriff($vText, $i, $Inventory_Startstring_Items, $Inventory_Endstring_Items) While NOT $j <= 0 $vTest = _GUICtrlListViewGetItemText($Inventory_Listview, ($j-1), 0, "MyGUI") If $vTest = $vItem Then;Item vorhanden MsgBox(0, "", "") _GUICtrlListViewSetItemText($Inventory_Listview, ($j-1), 1, (_GUICtrlListViewGetItemText($Inventory_Listview, ($j-1), 1, "MyGUI")+1)) $vTemp = 1 EndIf $j = $j - 1 WEnd If $vTemp = 0 Then GUICtrlCreateListViewItem ($vItem & "|1", $Inventory_Listview) EndIf $j = _GUICtrlListViewGetItemCount($Inventory_Listview) ;~ Sleep(2000) MsgBox(0, "Listenlänge", $j) Next Toggle_Images_Off(0) _IEAction($o_IE, "quit") EndFunc Try this? #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode()
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