Jump to content
Sign in to follow this  
Affe

IE Error after Update

Recommended Posts

Affe

Please see image below.

I have a program that has worked reliable for some time. I just updated Autoit, and now my script will randomly error out as it is manipulating Internet Explorer.

The error makes little sense to me (screen attached)

Does anyone know what is going on?

post-21241-0-47219300-1353441465_thumb.p


[center][/center]

Share this post


Link to post
Share on other sites
BrewManNH

My crystal ball says the problem is on line 49987 in the main script....

Seriously, do you expect anyone to figure out what the problem is without any information other than a screen shot of an error message?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Affe

I was kinda hoping that it would help out a little -- I didn't know it was related to my main script as it said the error was in the IE script.

My crystal ball tells me that no one will probably look through this, but I'm going to post it anyway...

So I guess here goes the best I can with this lengthy script...

First, here is the function that I start with. This function brings up a GUI where I input part numbers to be looked up:

Func Create_Item_Array()

Local $ListViewItems
Local $numitems = 1

#region ### START Koda GUI section ### Form=C:Documents and SettingsCoryDesktopSAMOrderEntry.kxf

$Form1_1_1 = GUICreate("SAM Order Entry", 635, 451, @DesktopWidth/2 - 317, @DesktopHeight/2 - 225)
$Items_ListView = GUICtrlCreateListView("Part Number|Qty|Loc|Vendor", 16, 16, 305, 417)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 85)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 35)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 130)
$AddItem_Group = GUICtrlCreateGroup("Add Item", 328, 16, 289, 231)
$Item_Number_Input = GUICtrlCreateInput("", 432, 40, 169, 21)
$Quantity_Input = GUICtrlCreateInput("", 432, 72, 169, 21)
$Shop_Combo = GUICtrlCreateCombo("", 432, 112, 169, 25)
GUICtrlSetData(-1, "Shop #4|Shop #5|Shop #6")
$Label1 = GUICtrlCreateLabel("Part Number:", 360, 40, 66, 17)
$Label2 = GUICtrlCreateLabel("Quantity:", 360, 72, 46, 17)
$Label3 = GUICtrlCreateLabel("Shop:", 360, 112, 32, 17)
$AddItem_btn = GUICtrlCreateButton("Add Item", 480, 176, 121, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_DISABLE)
$RemoveItem_btn = GUICtrlCreateButton("Remove Item", 344, 176, 113, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_DISABLE)
$GetLastVend_btn = GUICtrlCreateButton("Get Last Vendor", 480, 209, 121, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$CreateOrders_btn = GUICtrlCreateButton("Create Orders", 528, 384, 89, 41, $WS_GROUP)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)

#endregion ### END Koda GUI section ###
;~ GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Item_Number_Input
If GUICtrlRead($Quantity_Input) = Not "" And GUICtrlRead($Shop_Combo) = Not "" Then
GUICtrlSetState($AddItem_btn, $GUI_ENABLE)
EndIf
Case $Quantity_Input
If GUICtrlRead($Item_Number_Input) = Not "" And GUICtrlRead($Shop_Combo) = Not "" Then
GUICtrlSetState($AddItem_btn, $GUI_ENABLE)
EndIf
Case $Shop_Combo
If GUICtrlRead($Quantity_Input) = Not "" And GUICtrlRead($Shop_Combo) = Not "" Then
GUICtrlSetState($AddItem_btn, $GUI_ENABLE)
EndIf
Case $AddItem_btn
GUICtrlSetState($AddItem_btn, $GUI_DISABLE)
GUICtrlSetState($Item_Number_Input, $GUI_DISABLE)
GUICtrlSetState($Quantity_Input, $GUI_DISABLE)
GUICtrlSetState($Shop_Combo, $GUI_DISABLE)
GUICtrlSetState($RemoveItem_btn, $GUI_DISABLE)
GUICtrlSetState($CreateOrders_btn, $GUI_DISABLE)
GUICtrlSetState($GetLastVend_btn, $GUI_DISABLE)
$itemnum = StringUpper(GUICtrlRead($Item_Number_Input))
$itemqty = GUICtrlRead($Quantity_Input)
$itemshop = GUICtrlRead($Shop_Combo)

If Not IsArray($ListViewItems) Then Local $ListViewItems[1][5]

If $numitems > UBound($ListViewItems) Then ReDim $ListViewItems[$numitems][5]
$ListViewItems[$numitems - 1][0] = GUICtrlCreateListViewItem($itemnum & "|" & $itemqty & "|" & $itemshop & "|Awaiting Last Vendor...", $Items_ListView)
$ListViewItems[$numitems - 1][1] = $itemnum
$ListViewItems[$numitems - 1][2] = $itemqty
$ListViewItems[$numitems - 1][3] = $itemshop
$ListViewItems[$numitems - 1][4] = "Need" ;added because below code was commented, filler
;~ $lastvend = Get_Last_Vendor_Ordered($itemnum)
;~ If $lastvend = False Then
;~ $lastvend = "Unknown"
;~ EndIf
;~ $ListViewItems[$numitems - 1][4] = $lastvend
;~ GUICtrlSetData($ListViewItems[$numitems - 1][0], $itemnum & "|" & $itemqty & "|" & $itemshop & "|" & $ListViewItems[$numitems - 1][4])
;~ If $lastvend = "Unknown" then _GUICtrlListView_SetBkColor($ListViewItems[$numitems - 1][0], (0xDA3838))
$numitems += 1
GUICtrlSetState($RemoveItem_btn, $GUI_ENABLE)
GUICtrlSetState($CreateOrders_btn, $GUI_ENABLE)
GUICtrlSetData($Item_Number_Input, "")
GUICtrlSetData($Quantity_Input, "")
_GUICtrlComboBox_SetCurSel($Shop_Combo, -1)
GUICtrlSetState($Item_Number_Input, $GUI_ENABLE)
GUICtrlSetState($Quantity_Input, $GUI_ENABLE)
GUICtrlSetState($Shop_Combo, $GUI_ENABLE)
GUICtrlSetState($GetLastVend_btn, $GUI_ENABLE)
Case $RemoveItem_btn
$delete = GUICtrlRead($Items_ListView)
$count = 0
If IsArray($ListViewItems) Then
For $x = 0 To UBound($ListViewItems) - 1
If $delete = $ListViewItems[$x][0] Then
GUICtrlDelete($ListViewItems[$x][0])
_ArrayDelete($ListViewItems, $x)
$numitems -= 1
ExitLoop
EndIf
$count += 1
Next
EndIf
If Not IsArray($ListViewItems) Then
GUICtrlSetState($RemoveItem_btn, $GUI_DISABLE)
GUICtrlSetState($CreateOrders_btn, $GUI_DISABLE)
EndIf
Case $CreateOrders_btn
GUICtrlSetState($CreateOrders_btn, $GUI_DISABLE)
GUICtrlSetState($RemoveItem_btn, $GUI_DISABLE)
GUICtrlSetState($AddItem_btn, $GUI_DISABLE)
GUICtrlSetState($Item_Number_Input, $GUI_DISABLE)
GUICtrlSetState($Quantity_Input, $GUI_DISABLE)
GUICtrlSetState($Shop_Combo, $GUI_DISABLE)
GUICtrlSetState($GetLastVend_btn, $GUI_DISABLE)
For $x = 0 To UBound($ListViewItems) - 1
If $ListViewItems[$x][4] = "Need" Then
GUICtrlSetData($ListViewItems[$x][0], $ListViewItems[$x][1] & "|" & $ListViewItems[$x][2] & "|" & $ListViewItems[$x][3] & "|" & "Getting Last Vendor...")
$lastvend = Get_Last_Vendor_Ordered($ListViewItems[$x][1])
If $lastvend = False Then
$lastvend = "Unknown"
EndIf
$ListViewItems[$x][4] = $lastvend
GUICtrlSetData($ListViewItems[$x][0], $ListViewItems[$x][1] & "|" & $ListViewItems[$x][2] & "|" & $ListViewItems[$x][3] & "|" & $ListViewItems[$x][4])
If $lastvend = "Unknown" Then
GUICtrlSetBkColor($ListViewItems[$x][0], (0xFF0000))
;~ GUICtrlSetData($ListViewItems[$x][0], $ListViewItems[$x][1] & ": Cannot find vendor, enter order manually" & "|" & $ListViewItems[$x][2] & "|" & $ListViewItems[$x][3] & "|" & $ListViewItems[$x][4])
;~ GUICtrlSetTip($ListViewItems[$x][0], "Cannot find vendor, must enter order manually.")
Else
GUICtrlSetBkColor($ListViewItems[$x][0], (0x00FF00))
EndIf
EndIf
Next
;BEGIN SORTING ARRAY
;WE MUST CREATE AN ADDITIONAL DIMENSION TO SORT ON BASED UPON VENDOR AND SHOP
Local $orderarray = $ListViewItems
ReDim $ListViewItems[UBound($ListViewItems)][6]
For $x = 0 To UBound($ListViewItems) - 1
$ListViewItems[$x][5] = $ListViewItems[$x][4] & $ListViewItems[$x][3]
Next
_ArraySort($ListViewItems, 0, 0, 0, 5)
;~ ReDim $ListViewItems[UBound($ListViewItems)][5]
;~ _ArrayDisplay($ListViewItems)
;END SORTING OF ARRAY
For $x = 0 To UBound($ListViewItems) - 1
GUICtrlSetData($orderarray[$x][0], $ListViewItems[$x][1] & "|" & $ListViewItems[$x][2] & "|" & $ListViewItems[$x][3] & "|" & $ListViewItems[$x][4])
$ListViewItems[$x][0] = $orderarray[$x][0]
If $ListViewItems[$x][4] = "Unknown" Then
GUICtrlSetBkColor($ListViewItems[$x][0], (0xFF0000))
;~ GUICtrlSetData($ListViewItems[$x][0], $ListViewItems[$x][1] & ": Cannot find vendor, enter order manually" & "|" & $ListViewItems[$x][2] & "|" & $ListViewItems[$x][3] & "|" & $ListViewItems[$x][4])
;~ GUICtrlSetTip($ListViewItems[$x][0], "Cannot find vendor, must enter order manually.")
Else
GUICtrlSetBkColor($ListViewItems[$x][0], (0x00FF00))
EndIf
Next

Local $createarray
Local $badarray
Local $badcount = 0
$lastshop = $ListViewItems[0][3]
$lastvend = $ListViewItems[0][4]
$last = $ListViewItems[0][5]
$len = UBound($ListViewItems)
ReDim $ListViewItems[$len + 1][6]
$ListViewItems[$len][0] = "Done"
$count = 0


For $x = 0 To UBound($ListViewItems) - 1
If $ListViewItems[$x][4] = "Unknown" Then
If Not IsArray($badarray) Then Local $badarray[1][3]
If $badcount + 1 > UBound($createarray) Then ReDim $badarray[$badcount + 1][3]
$badarray[$badcount][0] = $ListViewItems[$x][1]
$badarray[$badcount][1] = $ListViewItems[$x][2]
$badarray[$badcount][2] = $ListViewItems[$x][3]
$badcount += 1
;~ _ArrayDisplay($badarray)
ElseIf $ListViewItems[$x][5] = $last Then
If Not IsArray($createarray) Then Local $createarray[1][2]
If $count + 1 > UBound($createarray) Then ReDim $createarray[$count + 1][2]
$createarray[$count][0] = $ListViewItems[$x][1]
$createarray[$count][1] = $ListViewItems[$x][2]
$count += 1
;~ _ArrayDisplay($createarray)
ElseIf $ListViewItems[$x][0] = "Done" Then
Create_Purchase_Order($lastshop, $lastvend, "SHIP ASAP. THANKS!", $createarray)
$ttlqty = 0
For $v = 0 To UBound($createarray) - 1
$ttlqty += Int($createarray[$v][1])
Next
$verify = Verify_Order($lastvend, $ttlqty)
;~ If $verify = False Then
;~ MsgBox(0, "ORDER ERROR", "The purchase order for " & $lastvend & " could not be verified")
;~ Exit
;~ EndIf
;ADDING IN VERIFY CHANGE HERE
If $verify = False Then
$oPO_Form = _IEFormGetObjByName($Location_Frame, "purchaseOrderForm")

$elements = _IEFormElementGetCollection($oPO_Form)
For $element In $elements
If StringInStr($element.value, "Add") > 0 Then
$button = $element
EndIf
Next

_IEAction($button, "click")
_IELoadWait($Location_Frame)

$neworderForm = _IEFormGetObjByName($Location_Frame, "receiptForm")
$elements = _IEFormElementGetCollection($neworderForm)

For $element In $elements
If StringInStr($element.name, "arPartNumber[" & $x & "]") > 0 Then
$partform = $element
$focuselement1 = $element
ElseIf StringInStr($element.name, "arDescription[" & $x & "]") > 0 Then
$focuselement2 = $element
ElseIf StringInStr($element.name, "arPartLocationID[" & $x & "]") > 0 Then
$partlocationform = $element
ElseIf StringInStr($element.name, "arQuantity[" & $x & "]") > 0 Then
$qtyform = $element
ElseIf StringInStr($element.name, "arPromiseDate[" & $x & "]") > 0 Then
$dateform = $element
EndIf
Next

For $x = 1 To UBound($createarray)
_IEFormElementOptionSelect($partlocationform, StringRight($lastshop, 1), 1, "byText", 1)
Next

For $element In $elements
If StringInStr($element.value, "Submit") > 0 Then
$button = $element
EndIf
Next
_IEAction($button, "click")
_IELoadWait($Location_Frame)

$verify = Verify_Order($lastvend, $ttlqty)
If $verify = False Then
MsgBox(0, "ORDER ERROR", "The purchase order for " & $lastvend & " could not be verified")
Exit

EndIf
EndIf
;ABOVE IS VERIFY CHANGE
Email_Order($verify, $lastvend)
For $v = 0 To UBound($createarray) - 1
_ArrayDelete($createarray, $v)
Next
ReDim $ListViewItems[$len][6]
If IsArray($badarray) Then
MsgBox(48, "WARNING: Not Ordered", "The items on the next chart could not be " & @CRLF & "ordered because no last vendor was available.")
_ArrayDisplay($badarray, "No Vendor/Bad Part Number")
For $v = 0 To UBound($badarray) - 1
_ArrayDelete($badarray, $v)
Next
EndIf
Else;If $ListViewItems[$x][5] = Not $last Then
Create_Purchase_Order($lastshop, $lastvend, "SHIP ASAP. THANKS!", $createarray)
$ttlqty = 0
For $v = 0 To UBound($createarray) - 1
$ttlqty += Int($createarray[$v][1])
Next
$verify = Verify_Order($lastvend, $ttlqty)
;~ If $verify = False Then
;~ MsgBox(0, "ORDER ERROR", "The purchase order for " & $lastvend & " could not be verified")
;~ Exit
;~ EndIf
;ADDING IN VERIFY CHANGE HERE
If $verify = False Then
$oPO_Form = _IEFormGetObjByName($Location_Frame, "purchaseOrderForm")

$elements = _IEFormElementGetCollection($oPO_Form)
For $element In $elements
If StringInStr($element.value, "Add") > 0 Then
$button = $element
EndIf
Next

_IEAction($button, "click")
_IELoadWait($Location_Frame)

$neworderForm = _IEFormGetObjByName($Location_Frame, "receiptForm")
$elements = _IEFormElementGetCollection($neworderForm)

For $element In $elements
If StringInStr($element.name, "arPartNumber[" & $x & "]") > 0 Then
$partform = $element
$focuselement1 = $element
ElseIf StringInStr($element.name, "arDescription[" & $x & "]") > 0 Then
$focuselement2 = $element
ElseIf StringInStr($element.name, "arPartLocationID[" & $x & "]") > 0 Then
$partlocationform = $element
ElseIf StringInStr($element.name, "arQuantity[" & $x & "]") > 0 Then
$qtyform = $element
ElseIf StringInStr($element.name, "arPromiseDate[" & $x & "]") > 0 Then
$dateform = $element
EndIf
Next

For $x = 1 To UBound($createarray)
_IEFormElementOptionSelect($partlocationform, StringRight($lastshop, 1), 1, "byText", 1)
Next

For $element In $elements
If StringInStr($element.value, "Submit") > 0 Then
$button = $element
EndIf
Next
_IEAction($button, "click")
_IELoadWait($Location_Frame)

$verify = Verify_Order($lastvend, $ttlqty)
If $verify = False Then
MsgBox(0, "ORDER ERROR", "The purchase order for " & $lastvend & " could not be verified")
Exit

EndIf
EndIf
;ABOVE IS VERIFY CHANGE
Email_Order($verify, $lastvend)
$count = 0
For $v = 0 To UBound($createarray) - 1
_ArrayDelete($createarray, $v)
Next
$lastshop = $ListViewItems[$x][3]
$lastvend = $ListViewItems[$x][4]
$last = $ListViewItems[$x][5]
If Not IsArray($createarray) Then Local $createarray[1][2]
If $count + 1 > UBound($createarray) Then ReDim $createarray[$count + 1][2]
$createarray[$count][0] = $ListViewItems[$x][1]
$createarray[$count][1] = $ListViewItems[$x][2]
$count += 1
;~ _ArrayDisplay($createarray)
EndIf
Next
If $fax_array[0] > 0 Then
_ArrayDisplay($fax_array, "These orders could not be emailed")
EndIf
WinActivate("SAM Order Entry")
;~ GUICtrlSetState($CreateOrders_btn, $GUI_ENABLE)
;~ GUICtrlSetState($RemoveItem_btn, $GUI_ENABLE)
GUICtrlSetState($Item_Number_Input, $GUI_ENABLE)
GUICtrlSetState($Quantity_Input, $GUI_ENABLE)
GUICtrlSetState($Shop_Combo, $GUI_ENABLE)
;~ GUICtrlSetState($GetLastVend_btn, $GUI_ENABLE)
Case $GetLastVend_btn
GUICtrlSetState($CreateOrders_btn, $GUI_DISABLE)
GUICtrlSetState($RemoveItem_btn, $GUI_DISABLE)
GUICtrlSetState($AddItem_btn, $GUI_DISABLE)
GUICtrlSetState($Item_Number_Input, $GUI_DISABLE)
GUICtrlSetState($Quantity_Input, $GUI_DISABLE)
GUICtrlSetState($Shop_Combo, $GUI_DISABLE)
GUICtrlSetState($GetLastVend_btn, $GUI_DISABLE)
For $x = 0 To UBound($ListViewItems) - 1
If $ListViewItems[$x][4] = "Need" Then
GUICtrlSetData($ListViewItems[$x][0], $ListViewItems[$x][1] & "|" & $ListViewItems[$x][2] & "|" & $ListViewItems[$x][3] & "|" & "Getting Last Vendor...")
$lastvend = Get_Last_Vendor_Ordered($ListViewItems[$x][1])
If $lastvend = False Then
$lastvend = "Unknown"
EndIf
$ListViewItems[$x][4] = $lastvend
GUICtrlSetData($ListViewItems[$x][0], $ListViewItems[$x][1] & "|" & $ListViewItems[$x][2] & "|" & $ListViewItems[$x][3] & "|" & $ListViewItems[$x][4])
If $lastvend = "Unknown" Then
GUICtrlSetBkColor($ListViewItems[$x][0], (0xFF0000))
;~ GUICtrlSetData($ListViewItems[$x][0], $ListViewItems[$x][1] & ": Cannot find vendor, enter order manually" & "|" & $ListViewItems[$x][2] & "|" & $ListViewItems[$x][3] & "|" & $ListViewItems[$x][4])
;~ GUICtrlSetTip($ListViewItems[$x][0], "Cannot find vendor, must enter order manually.")
Else
GUICtrlSetBkColor($ListViewItems[$x][0], (0x00FF00))
EndIf
EndIf
Next
GUICtrlSetState($CreateOrders_btn, $GUI_ENABLE)
GUICtrlSetState($RemoveItem_btn, $GUI_ENABLE)
GUICtrlSetState($Item_Number_Input, $GUI_ENABLE)
GUICtrlSetState($Quantity_Input, $GUI_ENABLE)
GUICtrlSetState($Shop_Combo, $GUI_ENABLE)
GUICtrlSetState($GetLastVend_btn, $GUI_ENABLE)
Case $GUI_EVENT_CLOSE
GUIDelete($Form1_1_1)
Return
EndSwitch
WEnd


EndFunc ;==>Create_Item_Array

You don't even need to look at that, but I figured I'd better put it in there because someone will say "THERE IS CODE MISSING, HOW AM I SUPPOSED TO HELP YOU".

Now, part of that function calls the "Get_Last_Vendor_Ordered" function below. This will loop for each $partnum passed to it. THIS IS WHERE THE ERROR IS OCCURRING, SOMEWHERE IN HERE:

Func Get_Last_Vendor_Ordered($partnum)
Open_Filters()
Filters_Select_Closed()
Filters_Set_PartNumber($partnum)
Filters_Submit()
$result = Filters_Get_Results(1)
If StringLen($result) < 1 Then
$result = False
EndIf
Return $result
EndFunc ;==>Get_Last_Vendor_Ordered

Now, the functions that function calls:

Func Open_Filters()
_IELoadWaitTimeout(5000)
;~ _IENavigate($Location_Frame, $main_url & $Operations_PurchaseOrders_url)
EY_Navigate("Purchase Orders")
$oPO_Form = _IEFormGetObjByName($Location_Frame, "purchaseOrderForm")
;~ While 1
;~ $oPO_Form = _IEFormGetObjByName($Location_Frame, "purchaseOrderForm")
;~ If $oPO_Form = 0 Then
;~ _IENavigate($Location_Frame, $main_url & $Operations_PurchaseOrders_url)
;~ Else
;~ Sleep(100)
;~ ExitLoop
;~ EndIf
;~ WEnd

$filterstoggle = _IEGetObjById($oPO_Form, "filtersToggle")
_IEAction($filterstoggle, "click")
EndFunc ;==>Open_Filters

Func Filters_Select_Closed()
$oFilter_Form = _IEFormGetObjByName($Location_Frame, "filterForm")

$select = _IEFormElementGetObjByName($oFilter_Form, "sFilterStatus")
_IEFormElementOptionSelect($select, "Closed", 1, "byText", 1)
EndFunc ;==>Filters_Select_Closed

Func Filters_Set_PartNumber($number)
$oFilter_Form = _IEFormGetObjByName($Location_Frame, "filterForm")

$input = _IEFormElementGetObjByName($oFilter_Form, "sFilterPartNumber")
_IEFormElementSetValue($input, $number)
EndFunc ;==>Filters_Set_PartNumber

Func Filters_Submit()
$oFilter_Form = _IEFormGetObjByName($Location_Frame, "filterForm")

$elements = _IEFormElementGetCollection($oFilter_Form)
For $element In $elements
If StringInStr($element.value, "Apply Filters") > 0 Then
$button = $element
EndIf
Next

_IEAction($button, "click")
_IELoadWait($Location_Frame)
EndFunc ;==>Filters_Submit

Func Filters_Get_Results($mode = 1)
    ;modes:
    ;1 = last ordered
    ;2 = most common
    Local $x = 0
    Local $count = 0
    Local $t = 0
    Local $FilterResults_Array[1][6]

    _IELoadWait($Location_Frame)
    Local $shtml = StringSplit(_IEDocReadHTML($Location_Frame), Chr(10))
    For $x = 0 To UBound($shtml) - 1
        $line = $shtml[$x]
        ;=================    Below reads the temp file into the $Results_Array    =================
        ;=================    $Results_Array[0] = PO Number                        =================
        ;=================    $Results_Array[1] = HTML Control for PO                =================
        ;=================    $Results_Array[2] = Vendor                            =================
        ;=================    $Results_Array[4] = Qutantity Rec'd                    =================
        ;=================    $Results_Array[5] = Total Quantity                        =================
        If StringInStr($line, "<TD class=whiteBordered><INPUT id=") = 0 Then
            $x = $x + 1
        ElseIf StringInStr($line, "<TD class=whiteBordered><INPUT id=") > 0 Then
            If UBound($FilterResults_Array) < $count + 1 Then ReDim $FilterResults_Array[$count + 1][6]
            $FilterResults_Array[$count][1] = $line
            $temp = StringStripWS(StringReplace($shtml[$x + 1], "<TD class=whiteBordered><NOBR>", ""), 3)
            $temp = StringReplace($temp, "&amp;", "&")
            $FilterResults_Array[$count][2] = StringReplace($temp, "</NOBR></TD>", "")
            $temp = StringStripWS(StringReplace($shtml[$x + 2], "<TD class=whiteBordered><NOBR>", ""), 3)
            $FilterResults_Array[$count][0] = Int(StringReplace($temp, "</NOBR></TD>", ""))
            $temp = StringStripWS(StringReplace($shtml[$x + 3], "<TD class=whiteBordered>", ""), 3)
            $FilterResults_Array[$count][3] = StringReplace($temp, "</TD>", "")
            $temp = StringStripWS(StringReplace($shtml[$x + 4], "<TD class=whiteBordered align=right>", ""), 3)
            $t = StringInStr($temp, "<")
            $temp = StringSplit(StringLeft($temp, $t - 1), "/")
            $FilterResults_Array[$count][4] = $temp[1]
            $FilterResults_Array[$count][5] = $temp[2]
            $x = $x + 6
            $count = $count + 1
        EndIf
    Next

    If $mode = 1 Then
        _ArraySort($FilterResults_Array, 0, 0, 0, 0)
        Return $FilterResults_Array[UBound($FilterResults_Array) - 1][2]
;~     ElseIf $mode = 2 Then
;~         _ArraySort($Results_Array, 0, 0, 0, 2)
;~         $tempvendor = $Results_Array[0][2]
;~         Local $SortingArray[1][2]
;~         Local $vendors = 0
;~         For $x = 0 to UBound($Results_Array) - 1
;~             If $Results_Array[$x][2] = Not $tempvendor Then
;~                 $SortingArray[$vendors][0] = $tempvendor
;~                 $SortingArray[$vendors][1] = $x + 1
    EndIf
EndFunc   ;==>Filters_Get_Results

Func EY_Navigate($page)
$page2 = StringLower(StringStripWS($page, 8))

;====MY YARD====
$viewyard = _IEGetObjById($oEY_MAIN, "O1")
$addcar = _IEGetObjById($oEY_MAIN, "O2")
$addmultiplecars = _IEGetObjById($oEY_MAIN, "O3")
$search = _IEGetObjById($oEY_MAIN, "O4")

;====OPERATIONS====
$purchaseorders = _IEGetObjById($oEY_MAIN, "O5")
$customerassignment = _IEGetObjById($oEY_MAIN, "O6")
$repairestimates = _IEGetObjById($oEY_MAIN, "O7")
$workorders = _IEGetObjById($oEY_MAIN, "O8")
$pickinventory = _IEGetObjById($oEY_MAIN, "O9")
$releaseforbilling = _IEGetObjById($oEY_MAIN, "O10")
$handheldimages = _IEGetObjById($oEY_MAIN, "O11")
$relieveinventory = _IEGetObjById($oEY_MAIN, "O12")

$page2 = Eval($page2)

_IEAction($page2, "click")
$pathbar = _IEGetObjById($oEY_MAIN, "pathbar")
While(StringInStr($pathbar.innerhtml, "Loading") <= 0)
Sleep(100)
WEnd
While(StringInStr($pathbar.innerhtml, $page) <= 0)
Sleep(100)
WEnd
_IELoadWait($Location_Frame)
EndFunc

I still don't understand how this causes an issue with "WEnd" in the IE script. Especially when this script has worked for over 2 years until I updated AutoIt last week.

Edited by Affe

[center][/center]

Share this post


Link to post
Share on other sites
someone

I've been a little out of Autoit lately, so maybe this is a dumb question, but can you give the version you had vs the version that isn't working? Also, if you go back to the previous version of Autoit does your code work? I ask because you want to make sure that nothing else changed that you didn't realize... same IE version, etc.

My guess about the While statement is its the object statement in the While (not the Wend).

I would try to cut down on the code you have, make it the absolute smallest it can be while still producing the same error.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

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  

  • Similar Content

    • rm4453
      By rm4453
      I have a table I am parsing, to find specific vehicle information. I am unable to get _ArrayFindAll to return the only valid result with my test data.
      Below is a sample of the table's HTML:
      <td class="textCenter">2010</td> <td>TOYOTA</td> <td>TACOMA 4X4 DB</td> <td></td> <td>BLACK</td> <td class="textCenter">C</td> <td class="textCenter">6</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter">4X4</td> <td class="textCenter">Y</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">80,975</td> <td class="textRight" nowrap="nowrap">$16,800</td> </tr> <tr><!-- 308 --> <td class="textCenter">2010</td> <td>TOYOTA</td> <td>TACOMA 4X4 RG</td> <td></td> <td>BLACK</td> <td class="textCenter">R</td> <td class="textCenter">4</td> <td>GAS</td> <td class="textCenter">5</td> <td class="textCenter">4X4</td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">95,224</td> <td class="textRight" nowrap="nowrap">$9,500</td> </tr> <tr><!-- 309 --> <td class="textCenter">2011</td> <td>BUICK</td> <td>REGAL</td> <td>CXL RL4</td> <td>BLACK</td> <td class="textCenter">4</td> <td class="textCenter">4</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter"></td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">SR</td> <td class="textCenter">L</td> <td class="textRight" nowrap="nowrap">102,694</td> <td class="textRight" nowrap="nowrap">$5,000</td> </tr> <tr><!-- 310 --> <td class="textCenter">2011</td> <td>CHEVROLET</td> <td>AVALANCH 4X4 CR</td> <td>LS</td> <td>GRAY</td> <td class="textCenter">C</td> <td class="textCenter">8</td> <td>E</td> <td class="textCenter">A</td> <td class="textCenter">4X4</td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">64,759</td> <td class="textRight" nowrap="nowrap">$16,300</td> </tr> <tr><!-- 311 --> <td class="textCenter">2011</td> <td>CHEVROLET</td> <td>EQUINOX AWD 4C</td> <td>LT W/2LT</td> <td>BLACK</td> <td class="textCenter">S</td> <td class="textCenter">4</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter">AWD</td> <td class="textCenter">Y</td> <td>CD</td> <td class="textCenter">SR</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">91,896</td> <td class="textRight" nowrap="nowrap">$4,400</td> </tr> <tr><!-- 312 --> <td class="textCenter">2011</td> <td>CHEVROLET</td> <td>TAHOE 4X4 V8</td> <td>LTZ</td> <td>WHITE</td> <td class="textCenter">S</td> <td class="textCenter">8</td> <td>C</td> <td class="textCenter">A</td> <td class="textCenter">4X4</td> <td class="textCenter">A</td> <td>N</td> <td class="textCenter">MR</td> <td class="textCenter">L</td> <td class="textRight" nowrap="nowrap">126,982</td> <td class="textRight" nowrap="nowrap">$17,800</td> </tr> <tr><!-- 313 --> <td class="textCenter">2011</td> <td>CHEVROLET</td> <td>1500 SLV 4X4 EX</td> <td>LT</td> <td>GRAY</td> <td class="textCenter">X</td> <td class="textCenter">8</td> <td>GAS</td> <td class="textCenter">O</td> <td class="textCenter">4X4</td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">60,303</td> <td class="textRight" nowrap="nowrap">$18,100</td> </tr> <tr><!-- 314 --> <td class="textCenter">2011</td> <td>CHEVROLET</td> <td>1500 SLV 4X4 EX</td> <td>LT</td> <td>SILVER</td> <td class="textCenter">X</td> <td class="textCenter">8</td> <td>E</td> <td class="textCenter">O</td> <td class="textCenter">4X4</td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">89,403</td> <td class="textRight" nowrap="nowrap">$15,900</td> </tr> <tr><!-- 315 --> <td class="textCenter">2011</td> <td>CHEVROLET</td> <td>1500 SLV 4X4 EX</td> <td>LTZ</td> <td>BLUE</td> <td class="textCenter">X</td> <td class="textCenter">8</td> <td>E</td> <td class="textCenter">A</td> <td class="textCenter">4X4</td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">L</td> <td class="textRight" nowrap="nowrap">53,087</td> <td class="textRight" nowrap="nowrap">$17,700</td> </tr> <tr><!-- 316 --> <td class="textCenter">2011</td> <td>CHEVROLET</td> <td>3500 CUTAWAY</td> <td>WORK VAN</td> <td>WHITE</td> <td class="textCenter">S</td> <td class="textCenter"></td> <td></td> <td class="textCenter">A</td> <td class="textCenter">4X2</td> <td class="textCenter"></td> <td>N</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">202,477</td> <td class="textRight" nowrap="nowrap">$2,700</td> </tr> <tr><!-- 317 --> <td class="textCenter">2011</td> <td>CHRYSLER</td> <td>TOWN &amp; COUNTRY</td> <td>TOURING</td> <td>BLACK</td> <td class="textCenter">4</td> <td class="textCenter">6</td> <td>E</td> <td class="textCenter">A</td> <td class="textCenter">4X2</td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter"></td> <td class="textRight" nowrap="nowrap">198,541</td> <td class="textRight" nowrap="nowrap">$1,900</td> </tr> <tr><!-- 318 --> <td class="textCenter">2011</td> <td>DODGE</td> <td>DURANGO AWD V6</td> <td>CREW</td> <td>BLUE</td> <td class="textCenter">S</td> <td class="textCenter">6</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter">AWD</td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">SR</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">176,036</td> <td class="textRight" nowrap="nowrap">$2,800</td> </tr> <tr><!-- 319 --> <td class="textCenter">2011</td> <td>FORD</td> <td>FOCUS</td> <td>SE</td> <td>SILVER</td> <td class="textCenter">4</td> <td class="textCenter">4</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter"></td> <td class="textCenter">Y</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">101,929</td> <td class="textRight" nowrap="nowrap">$3,100</td> </tr> <tr><!-- 320 --> <td class="textCenter">2011</td> <td>FORD</td> <td>FUSION FWD 4C</td> <td>SEL</td> <td>WHITE</td> <td class="textCenter">4</td> <td class="textCenter">4</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter"></td> <td class="textCenter">Y</td> <td>CD</td> <td class="textCenter">SR</td> <td class="textCenter">L</td> <td class="textRight" nowrap="nowrap">78,290</td> <td class="textRight" nowrap="nowrap">$5,500</td> </tr> <tr><!-- 321 --> <td class="textCenter">2011</td> <td>FORD</td> <td>F150 4X4 CR</td> <td>XLT</td> <td>BLACK</td> <td class="textCenter">C</td> <td class="textCenter">8</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter">4X4</td> <td class="textCenter">Y</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">70,909</td> <td class="textRight" nowrap="nowrap">$16,000</td> </tr> <tr><!-- 322 --> <td class="textCenter">2011</td> <td>FORD</td> <td>MUSTANG V6 CPE</td> <td>V6 PREMIUM</td> <td>BLACK</td> <td class="textCenter">2</td> <td class="textCenter">6</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter">4X2</td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">L</td> <td class="textRight" nowrap="nowrap">92,531</td> <td class="textRight" nowrap="nowrap">$2,700</td> </tr> <tr><!-- 323 --> <td class="textCenter">2011</td> <td>GMC</td> <td>ACADIA FWD</td> <td>SLE</td> <td>RED</td> <td class="textCenter">4</td> <td class="textCenter">6</td> <td>GAS</td> <td class="textCenter">A</td> <td class="textCenter"></td> <td class="textCenter">A</td> <td>CD</td> <td class="textCenter">HT</td> <td class="textCenter">C</td> <td class="textRight" nowrap="nowrap">79,199</td> <td class="textRight" nowrap="nowrap">$10,700</td> A picture of the table test data is attached here:

      Here is the _query function, and all other relevant code that I can share.
       
      Func _query($aSel, $aUrls) $oIE = _login() If $oIE = "Return" Then Return EndIf $j = 0 While $j < UBound($aSel) - 1 $i = 1 $aucID ;Unable To Share What This Is Other Than Var Name. _IENavigate($oIE, "Something" & $aucID[0] & "Something") _IELoadWait($oIE, 100, 2000) $oObj = _IETableGetCollection($oIE, 3) $cars = _IETableWriteToArray_ProgressBar($oObj, True, "Processing Requested Information!") ;<---- Modified Version See Post For It: https://www.autoitscript.com/forum/topic/195335-solved-how-to-add-a-progress-bar-to-_ietablewritetoarray/?tab=comments#comment-1400699 $carsYear = _filter($cars, 0, 0, GUICtrlRead($year)) $carsMake = _filter($carsYear, 0, 1, GUICtrlRead($make)) Global $carsModel = _filter($carsMake, 0, 2, GUICtrlRead($model)) $i = 0 $engine = GUICtrlRead($engine) If $engine <> "" Then While $i < StringLen($engine) $carsEngine = _filter($carsModel, 0, 6 + $i, StringLeft($engine, 1)) ;_ArrayDisplay($carsModel, "Cars Model Before Array Delete") $x = 1 While $x <= UBound($carsModel) _ArrayDelete($carsModel, $x) $x += 1 WEnd ;_ArrayDisplay($carsModel, "Cars Model After Array Delete") ;_ArrayConcatenate($carsModel, $carsEngine) ;_ArrayDisplay($carsModel, "Cars Model After Concatenate") $engine = StringTrimLeft($engine, 1) $i += 1 WEnd Else Dim $carsEngine[1][16] EndIf _ArrayConcatenate($carsEngine, $carsModel) _ArrayDisplay($carsEngine, "Cars Engine") Dim $carsDriveTrain[1][16] Dim $carsDriveTrain2[1][16] $driveTrainVal = GUICtrlRead($driveTrain) If $driveTrainVal = "4x4" Or $driveTrainVal = "awd" Then $carsDriveTrain = _filter($carsEngine, 0, 9, "4") $carsDriveTrain2 = _filter($carsEngine, 0, 9, "a") ;~ _ArrayDisplay($carsDriveTrain, "Drive Train Before") ;~ If @error Then ;~ MsgBox("", "", "Cars Drive Train Error: " & @error) ;~ EndIf ;~ _ArrayDisplay($carsDriveTrain2, "Drive Train2 Before") ;~ If @error Then ;~ MsgBox("", "", "Cars Drive Train 2 Error: " & @error) ;~ EndIf _ArrayConcatenate($carsDriveTrain, $carsDriveTrain2) _ArrayDisplay($carsDriveTrain, "Drive Train After Concat") ElseIf $driveTrainVal = "" Then _ArrayConcatenate($carsDriveTrain, $carsEngine) Else $carsDriveTrain = _filter($carsEngine, 0, 9, $driveTrain) EndIf Dim $carsOdom[1][16] $min = GUICtrlRead($odomMin) $max = GUICtrlRead($odomMax) For $i = 0 To UBound($carsDriveTrain) - 1 If $carsDriveTrain[$i][14] > $min And $carsDriveTrain[$i][14] < $max Then _ArrayAdd($carsOdom, $carsDriveTrain[$i]) MsgBox("", "", "ADDED!") EndIf Next _ArrayDisplay($carsOdom, "Cars Odom") $j += 1 WEnd _IEQuit($oIE) EndFunc ;==>_query Func _filter($tofilter, $xpos1, $ypos1, $str) ;~ If UBound($tofilter, 1) <= 1 Then ;~ $endx = 0 ;~ Else ;~ $endx = UBound($tofilter, 1) - 1 ;~ EndIf ;~ $cars = _ArrayFindAll($tofilter, $str, $tofilter[$xpos1][$ypos1], $tofilter[$endx][$ypos1], 0, 1, $ypos1, False) $cars = _ArrayFindAll($tofilter, $str, Default, Default, 0, 1, $ypos1) Dim $carsFiltered[1][16] = [["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"]] ;_ArrayDisplay($carsFiltered) $i = 0 $uBound = UBound($cars) - 1 While $i < $uBound $filtered = _ArrayExtract($tofilter, $cars[$i], $cars[$i], 0, 15) ;_ArrayDisplay($filtered, "_filter Array of Filtered") _ArrayConcatenate($carsFiltered, $filtered) $i += 1 WEnd _ArrayDelete($carsFiltered, 0) Return $carsFiltered EndFunc ;==>_filter  
      If you know of a more efficient way of doing this please let me know would be more than happy to chew down my inefficiency while learning! (It's like my grandpa used to say, "The only criticism I can't use is that which is not given to me.")
       
      The Item an I am using to test the filter is:

       
    • rm4453
      By rm4453
      Hello,
       
      I am currently writing a program that parses a massive table from a website, and need a way to add a progress bar while parsing.
      I am currently using the function _IETableWriteToArray($oObj, True) to parse the array. I need the progress bar to update as the table is parsed, not just at the end of the parsing.
      Any help at all would be very much appreciated!
       
      *EDIT --> The array I am left with after parsing is $array[0-50000][16]
    • SkysLastChance
      By SkysLastChance
      I have a goofy problem. I am hoping someone could shed some light. The example is not going around the text box. It is way off. 
      I have seen some post blaming IE 11, however I have IE11 on my desktop and it works fine.
      Is there anything I can do that might fix this? 
       
      ; Open a browser with the form example and get a reference to the form ; textarea element. Get the coordinates and dimensions of the text area, ; outline its shape with the mouse and come to rest in the center #include <IE.au3> Local $oIE = _IE_Example("form") Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm") Local $oTextArea = _IEFormElementGetObjByName($oForm, "textareaExample") ; Get coordinates and dimensions of the textarea Local $iScreenX = _IEPropertyGet($oTextArea, "screenx") Local $iScreenY = _IEPropertyGet($oTextArea, "screeny") Local $iWidth = _IEPropertyGet($oTextArea, "width") Local $iHeight = _IEPropertyGet($oTextArea, "height") ; Outline the textarea with the mouse, come to rest in the center Local $iMousespeed = 50 MouseMove($iScreenX, $iScreenY, $iMousespeed) MouseMove($iScreenX + $iWidth, $iScreenY, $iMousespeed) MouseMove($iScreenX + $iWidth, $iScreenY + $iHeight, $iMousespeed) MouseMove($iScreenX, $iScreenY + $iHeight, $iMousespeed) MouseMove($iScreenX, $iScreenY, $iMousespeed) MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed)  
       
    • SkysLastChance
      By SkysLastChance
      So I have two things I am trying to click.
      Policy which works.
      $oInputs3 = _IETagNameGetCollection($oIE, "div") For $oInput3 in $oInputs3 If StringStripWS($oInput3.innertext,1) = "Policy" Then $target = $oInput3 _IELoadWait($target,"",70000) ExitLoop EndIf Next _IEAction($target, "click")  

      And Add Insurance which I havent been able to get to work. 
      $oInputs2 = _IETagNameGetCollection($oIE, "div") For $oInput2 in $oInputs2 If StringStripWS($oInput2.innertext,1) = "Add Insurance" Then $target = $oInput2 _IELoadWait($target,"",70000) ExitLoop EndIf Next _IEAction($target, "click")

      Any Ideas on what I am doing wrong?  I feel like it might be the spaces between >  Add Insurance  < but I am not sure. 
    • FMS
      By FMS
      Hello,
      I'm trying to read a div element and wait until it hits 100%.
      The structure is like :
      <div class="progress-bar" style="width: 48.0219%;  overflow: hidden; "></div>
      And want to wait until :
      <div class="progress-bar" style="width: 100%;  overflow: hidden; "></div>
      because afther this there will be an redirection whish i don't know the URL from and want to catsh this URL.
      And want to push a button on this redidertion page.

      Is there a best pratice way how to do this or is there a better way to wait for the redirection?
      Maybe wait until button exist or something?

      Does anybody could give me some tips about this challange?
       
      thnx in advanced.
       
      #include <IE.au3> Global $IE_flvto = _IECreate("https://www.website.com/",0,1,1,1) Global $oForm = _IEFormGetObjByName ($IE_flvto, "convertForm") Global $oText = _IEFormElementGetObjByName ($oForm, "convertUrl") _IEFormElementSetValue ($oText, "some text") _IEFormSubmit($oForm) ;wait for redirection ;if redirection loaded push button  
×