Sign in to follow this  
Followers 0
Affe

IE Error after Update

4 posts in this topic

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



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

#3 ·  Posted (edited)

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

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  
Followers 0

  • Similar Content

    • toto22
      By toto22
      I'm trying to click on Java Dropbox using IE. However, I'm running into problems. There is a Dropbox "Please Select" with two options "Buy" and "Sell".
      I'm able to click on a drop box (please see code below) but i'm unable to select "Buy" or "Sell"".
      Local $sMyString = "Please Select" ;############ ENTER ############# Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next  
      Please help
       
         
    • Gowrisankar
      By Gowrisankar
      Hello everyone,
      I'm working on a task where, a PDF file is opened (in IE browser) when I click a link in a website.
      I have to read the first page of the PDF to find particular strings. Can you please share some ideas?
    • Seminko
      By Seminko
      Hey,
      i would like to set a value into an INPUT field.
      Checked the _IEFormElementSetValue function but that does require _IEFormGetObjByName and this is where the problem comes in. The input field I want to write to is not a part of a form tag. It is part of a table.
      <input type="text" class="w2" id="nabidka_vozidel_formular_tach_od" name="nabidka_vozidel_formular_tach_od" onchange="GLOBAL.pocetInzerceNZ(&quot;nabidka_vozidel_formular&quot;,&quot;tach_od&quot;,&quot;&quot;);" autocomplete="off"> I tried this but that didn't work:
      $oDownloadSamples = _IEGetObjById($oIE, "nabidka_vozidel_formular_tach_od") _IEFormElementSetValue($oDownloadSamples, "123") If you want to try the site I'm working with is https://www.tipcars.cz/. There is a menu on the top left hand side and if you click the "vyhledat" button the input fields will show up.
      Thanks
    • Seminko
      By Seminko
      I am now able to populate the dropdown menus at https://www.tipcars.com/.
      The dropdowns are dynamic and do not have a Text value, only ids.
      Is there a way to get all the available options from a dropdown?
      $url = "https://www.tipcars.com/" $oIE = _IECreate($url) _IELoadWait($oIE) $oDownloadSamples = _IEGetObjById($oIE, "homepage_vyhl_frm_vozidlo") _IEFormElementOptionSelect($oDownloadSamples, "C") Above code, populates ID 'C' into the 'druh' dropdown, which results in selecting 'užitkové'. 
      Is there a way so I can grab all of the options from the dropdown menu? I could easily grab all the IDs but I am afraid they will change in the future so I would much rather match the text titles and assign the option IDs grabbed from site.
      This is what the options are according to Chrome:
      <select class="w1"id="homepage_vyhl_frm_vozidlo"name="homepage_vyhl_frm_vozidlo"onchange="try{NABIDKA_VOZIDEL_FORMULAR.naplnSelectZnacka('homepage_vyhl_frm');GLOBAL.pocetInzerceHZ('homepage_vyhl_frm','vozidlo');}catch(ex){odeslatJsChybu('formHOMEPAGE onChange 1: ' + ex.message, 'formHomePage onChange 1', -1);}"> <option value="A" style="color: black;">osobní a terénní (56 334)</option> <option value="C" style="color: black;">užitkové (4 333)</option> <option value="D" style="color: black;">nákladní (3 742)</option> <option value="E" style="color: black;">autobusy (56)</option> <option value="F" style="color: black;">obytné (373)</option> <option value="G" style="color: black;">přívěsy (1 179)</option> <option value="J" style="color: black;">motorky (780)</option> <option value="S" style="color: black;">pracovní stroje (605)</option> <option value="L" style="color: black;">ostatní (235)</option></select> Also, this cannot be grabbed by _INetGetSource.
      Thanks
    • Spask
      By Spask
      Hi, I'm trying to find a text value inside of a html.
      This is what the line looks like normally:
      <p id="line1" class> <span class="bot">TEXT HERE</span> </p> The text then changes to a non breaking space:
      <p id="line1" class> <span class="bot">&nbsp;</span> </p> And then it changes back to normal text but it's different every time.
      Can I code this so that it grabs the text every time it changes and has a variable that represents it?
      I currently have this inside of my loop:
      $span = .document.getElementsByTagName("span") For $text In $span If $text.value = "&nbsp;" Then Sleep(50) MsgBox(0,0,0) ;messagebox to test if it can be found, but I don't know how to grab the text EndIf Next The problem is that there are many other lines in the html that have the same span but are called "line3", "line5", etc and the one I need is from "line1".
      I will appreciate if anyone can help with this!