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

    • XinYoung
      By XinYoung
      For fun, I'm building an app that opens a webpage and refreshes it every 30 seconds.
      But once the script performs _IEAction($oIE, "refresh"), the GUI closes.
      Any help is appreciated.
       

      #include <ButtonConstants.au3>
      #include <EditConstants.au3>
      #include <GUIConstantsEx.au3>
      #include <StaticConstants.au3>
      #include <WindowsConstants.au3>
      #include <WinAPIFiles.au3>
      #include <Array.au3>
      #include <File.au3>
      #include <Excel.au3>
      #include <DateTimeConstants.au3>
      #include <MsgBoxConstants.au3>
      #include <WinAPIShellEx.au3>
      #include <MsgBoxConstants.au3>
      #include <Date.au3>
      #include <ComboConstants.au3>
      #include <guimenu.au3>
      #include <IE.au3>
      HotKeySet("{F4}", "_Exit")
      ;Open the file(s) in the selected folder
      $extension = ".txt"
      $app2openWith = @SystemDir & "\notepad.exe"
      Func Begin()
          Global $loopTrick = 0
          #Region ### START Koda GUI section ### Form=c:\users\mchu\downloads\autoit\my code\form1.kxf
          Global $UI = GUICreate("Hit Em Up!", 256, 113, -1, -1)
          GUISetBkColor(0x000000)
          $menu = _GUICtrlMenu_GetSystemMenu($UI)
          _GUICtrlMenu_EnableMenuItem($menu, $SC_CLOSE, 1, False)
          Global $url = GUICtrlCreateInput("https://www.youtube.com/watch?v=dQw4w9WgXcQ", 81, 8, 160, 21)
          $Label1 = GUICtrlCreateLabel("Target:", 16, 8, 55, 17)
          GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
          GUICtrlSetColor(-1, 0x00FF00)
          Global $StartBut = GUICtrlCreateButton("Start", 16, 40, 67, 25)
          GUICtrlSetFont(-1, 13, 800, 0, "MS Sans Serif")
          GUICtrlSetBkColor(-1, 0x008000)
          $Label2 = GUICtrlCreateLabel("(Press F4 to Exit)", 96, 40, 8000, 17)
          GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
          GUICtrlSetColor(-1, 0x00FF00)
          GUISetState(@SW_SHOW)
          #EndRegion ### END Koda GUI section ###
          While 1
              $UIfunc = GUIGetMsg()
              Select
                  Case $UIfunc = $GUI_EVENT_CLOSE
                      _Exit()
                  Case $UIfunc = $StartBut
                      If GUICtrlRead($url) = "" Then
                          MsgBox(48, "Um...", "Give me a target you idiot.")
                      Else
                          GUICtrlSetState($url, $GUI_DISABLE)
                          GUICtrlSetState($StartBut, $GUI_DISABLE)
                          Start()
                      EndIf
              EndSelect
          WEnd
      EndFunc   ;==>Begin
      Func Start()
          If $loopTrick = 0 Then
              Global $oIE = _IECreate(GUICtrlRead($url))
              _IELoadWait($oIE)
              Again()
          ElseIf $loopTrick = 1 Then
              Sleep(3000)
              _IEAction($oIE, "refresh")
              Sleep(3000)
              Start()
          EndIf
      EndFunc   ;==>Start
      Func Again()
          $loopTrick = 1
          Start()
      EndFunc   ;==>Again
      Func _Exit()
          Exit
      EndFunc   ;==>_Exit
    • mLipok
      By mLipok
      I have some problems with windows explorers.
      Here is my testing snippet:
      ;~ #RequireAdmin _Example() MsgBox(1, '', '@error = ' & @error & @CRLF & '@extended = ' & @extended) Func _Example() Local $oShell = ObjCreate("shell.application") If @error then Return SetError(1, @extended, 0) Local $oShellWindows = $oShell.windows If @error then Return SetError(2, @extended, 0) If $oShellWindows = Null Then Return SetError(3, 0, 0) Local $iCount = $oShellWindows.Count If @error then Return SetError(4, $iCount, 0) Return SetExtended($iCount,1) EndFunc ;==>_Example Normally this should return in extended number of opened InternetExplorer + WindowsExplorer.
      But in some cases I encounter a problem with this, as there happens situation when @extended returns 0 even if I had already opened IE.
      Here is one of them:
      I have some script which is working fine with IE on about 100 computers.
      In this specyfic case this script starts his work, and after few minutes he stoped works.
      All the time IE is still responsive, I can click on elements and go to specyfic places.
      Restoring the script did not help because _IEAttach () does not work.
      All you need to do is restart InternetExplorer.
       
      As a result of all my investigation I had done you can see this script snippet above.
      In my case My primary script was doing their job, but when he stops, IE was still responsive but this above snippet starts to return @error=0 and @extended = 0 when @extended should be at least =1 (this opened Internet Explorer instance)
      QUESTION:
      Has anyone already encountered such a problem?
      Does anyone know any solution or has an idea for further diagnostics?
       
      btw.
      I have one solution which would fix it - I mean Windows reinstall, but this is not good solution, as I always like to know the esense of the problem.
       
      EDIT:
      I know you can say show the script........ this is not possible you have no access to this site, and about 100 computers works well, so this i not related to my script.
      The more so that the problem is not related to my main scripts, and the problem is simply how IE behaves - which is illustrated by the above piece of code.
       
    • Nareshm
      By Nareshm
      i want to repeat this function 
      _IELoadWait($oIE, "url 2") $checkb = _IEGetObjById($oIE,"checkb") _IEAction($checkb,"click") $img = _IEGetObjById($oIE,"img") _IEAction($img,"click") _IELoadWait($oIE, "url 1") $btnfy = _IEGetObjById($oIE,"btnvfy") _IEAction($btnfy,"click") until my targeted webpage not found.
    • Robdog1955
      By Robdog1955
      I'm trying to click a button on a web page. I have added a couple of MsgBox lines to allow me to watch what happens on the page. As you can see the first half of my script enters data into text boxes on the page. I have no problem there. I just cannot click on the region buttons. The "set focus" line causes an outline to appear around the EU button and the "click button" line causes the "Pick a Region" text to disappear. Here is the code I have so far.
      #include <IE.au3> Local $oIE = _IECreate("http://questchecker.com/") Local $iQuestID = "123456" Local $sCharacterName = "CharacterName" Local $colForms = _IEFormGetCollection($oIE) $iCount = 0 For $oForm In $colForms $oFormElements = _IEFormElementGetCollection($oForm) For $oFormElement In $oFormElements $iCount = $iCount + 1 Local $sTagName = StringLower($oFormElement.tagName) Local $sElementType = $oFormElement.type Local $sElementName = $oFormElement.name Switch $iCount Case 6 _IEFormElementSetValue($oFormElement, "MyRealm", 0) ; realm Case 7 _IEFormElementSetValue($oFormElement, $sCharacterName, 0) Case 8 _IEFormElementSetValue($oFormElement, $iQuestID, 0) EndSwitch Next Next Local $oButtons = _IEGetObjByName($oIE, "questForm") For $oButton In $oButtons If _IEFormElementGetValue($oButton) = "US" Then MsgBox(0, "", "Click Okay to set focus") _IEAction($oButton, "focus") MsgBox(0, "", "Click Okay to click button") _IEAction($oButton, "click") ExitLoop EndIf Next MsgBox(0, "", "Click Okay to quit") _IEQuit($oIE) Exit  
    • Dent
      By Dent
      As the title says. I open IE11 and navigate to a page with the following HTML5 file upload container in Capture0.JPG
      I want to click Add Files but I haven't been able to. Here's the code that handles the Add Files button in Capture.JPG
      _IEGetObjectById and then using _IEAction to click it doesn't work. I can't give access to the actual page unfortunately because it's password protected.
      All suggestions welcome.


×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.