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

    • FMS
      By FMS
      Hello,
      I try to get all the text from a news site around a subject.
      The first run I get all the text inside a attribute in an array.
      When i try to go back and reload another page it chrashes and think it because "$oIE.GoBack"
      I couldn't find anything in the help/forum around this subject.
      Do I need to reload the $oIE or something afther an X.GoBack?
      The error i got is :
      if $oTag2.GetAttribute("class") == "NewsDetail" Then if $oTag2^ ERROR I'm not shure why I got this error, maybe someone could explain?
      Also I'm open for some pointers in this test script because I'm pretty new in working whit the IE.UDF
      Maybe there is an simpler way to get the same results?

      test script:
      #include <IE.au3> #include <MsgBoxConstants.au3> #include <Array.au3> HotKeySet("{ESC}", "Terminate") Global $oIE = _IECreate("https://www.iex.nl/Zoeken/Nieuws.aspx?q=air%20france") ;get first subject Global $oLink1 = _IEGetObjById($oIE, "ctl00_ctl00_Content_LeftContent_NewsSearch_repNews_ctl00_linkNews") Sleep(500) _IEAction($oLink1, "click") Sleep(500) Global $oTags = _IETagNameGetCollection($oIE, "div") Global $aResults[1] For $oTag In $oTags if $oTag.GetAttribute("class") == "NewsDetail" Then _ArrayAdd($aResults, $oTag.innerTEXT) EndIf Next $aResults[0] = UBound($aResults) - 1 _ArrayDisplay($aResults, "Episodelist") ConsoleWrite($aResults[1] & @CRLF) $oIE.GoBack ;get second subject Global $oLink2 = _IEGetObjById($oIE, "ctl00_ctl00_Content_LeftContent_NewsSearch_repNews_ctl01_linkNews") Sleep(500) _IEAction($oLink2, "click") Sleep(500) Local $oTags2 = _IETagNameGetCollection($oIE, "div") Local $aResults2[1] For $oTag2 In $oTags2 if $oTag2.GetAttribute("class") == "NewsDetail" Then _ArrayAdd($aResults2, $oTag2.innerTEXT) EndIf Next $aResults2[0] = UBound($aResults2) - 1 ConsoleWrite($aResults2[1] & @CRLF) Func Terminate() _IEQuit($oIE) Exit EndFunc ;==>Terminate  
    • SkysLastChance
      By SkysLastChance
      I am having a hard time understanding why this is not working. I was hoping some one could help explain it to me. 
      $tags = $oIE.document.GetElementsByTagName("input") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "fTs-p3298-l0 wplEditControl" Then $target = $tag ExitLoop EndIF Next MsgBox(0,"",$target) If $target = "fTs-p3298-l0 wplEditControl" THEN MsgBox(0,"","itworked") I have tried 
       MsgBox(0,"",$target.Attribute)  MsgBox(0,"",$target.Value)  MsgBox(0,"",$target.InnerText) I would expect to see this in the msgbox
      fTs-p3298-l0 wplEditControl  
    • SkysLastChance
      By SkysLastChance
      I am trying to grab the id "in2xk_26" however it the characters before the underscore always change. (in the name too)
      Is there a way I can find a id or name by the last 3 charcters?
      Using something like "stringright?"
      So I would want to search for just "_26" in this case.
      This is assuming that there are no other _26
       

      #include <Excel.au3> #include <IE.au3> #include <GUIConstantsEx.au3> Global $iMousespeed = 25,$target = "",$TagName = "",$Value = "",$Atrribute = "" $oIE = _IEAttach("MEDITECH") $TagName = "input" $Value = "in2xk_26" $Attribute = "id" $tags = $oIE.document.GetElementsByTagName($TagName) ;TagName ------ MAKE SURE TO NAME THESE For $tag in $tags $class_value = $tag.GetAttribute($Attribute) ;Attribute ------ MAKE SURE TO NAME THESE If string($class_value) = $Value Then ;Value ------ MAKE SURE TO NAME THESE $target = $tag $iScreenX = _IEPropertyGet($target, "screenx") $iScreenY = _IEPropertyGet($target, "screeny") $iWidth = _IEPropertyGet($target, "width") $iHeight = _IEPropertyGet($target, "height") $oMouseCords = MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed) MouseClick($MOUSE_CLICK_LEFT) ExitLoop EndIf Next  
       
    • SkysLastChance
      By SkysLastChance
      I was wondering how I read data inside of a iframe. I would like to be able to click something inside a iframe. However, I can't even find the tag. 
      The id and name change all the time so I can't use those. 
      The code highlighted in blue is what I am trying to click. (second picture)
      Here is what I have tried.
      $target = "" $tags = $oIE.document.GetElementsByTagName("div") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "s_92 altstyle s_93 s_94" Then $target = $tag ConsoleWrite("Tag Found " & $target.outerText&@CRLF) ExitLoop EndIf Next  

       
       

    • SkysLastChance
      By SkysLastChance
       
      WinActivate("MEDITECH - Internet Explorer") Sleep (500) $oIE = _IEAttach("MEDITECH") $oDiv1 = _IEGetObjById($oIE, "sysmenu-searchbarbutton") _IEAction($oDiv1, "click") I am just trying to click the little magnifying glass, next to the gear button with no luck. I was hoping someone might have an idea why this is not working?
       

×