Jump to content

Internet Explorer Script now not working after update


Go to solution Solved by dar100111,

Recommended Posts

  • Moderators

How about posting your code, along with the problems you're having, rather than asking us to guess ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

 Hey JL,

Understood.  It was just a question of theory.  Codes been working for a year and a half.  Just trying to figure out what changed aside from Internet Explorer.

 

Case $linkbutton is the portion I'm having problems.  Getting to like 206 and it's just stopping.  Not erring out just not continuing.

Getting to the page ok as well.

_IENavigate($oIE, "http://forwardair.com/servlet/fwrd.unix.servlet.StartOnlineShippingServlet",1)
   _IELoadWait($oIE)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=fa_images\faicon.ico
#AutoIt3Wrapper_Outfile=FWDN Booking Tool v1.6.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;this script writes excel files to an array  This is written by 

#include <IE.au3>
#include <Excel.au3>
#include <Array.au3>
#include <Clipboard.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$filelocation = @ScriptDir & "\"
$sqlquerybase = "SELECT SH.CONSOL_REF ,OH.SHPMNT_REF ,OH.ONHAND_REF  ,INT(OI.PCS),INT(OI.LENGTH_2 / 254),INT(OI.WIDTH_2 / 254),INT(OI.HEIGHT_2 / 254),TRIM(CH.PORT_ORIGIN),TRIM(CH.PORT_DESTIN),CH.UOM_DIM ,CH.PCS_GRS ,INT(CH.WGT_GRS_1 *.000220462) FROM EXPORT.SHPMNT_HDR SH                        LEFT JOIN EXPORT.ONHAND_HDR OH                 ON SH.SHPMNT_REF = OH.SHPMNT_REF         LEFT JOIN EXPORT.ONHAND_ITEM OI                 ON OH.ONHAND_REF = OI.ONHAND_REF        LEFT JOIN EXPORT.CONSOL_HDR CH                ON CH.CONSOL_REF = SH.CONSOL_REF   WHERE        SH.CONSOL_REF IN ("



;;;;;;Gui Creation
GUICreate("FWDN Tool", 190, 280)
GUICtrlCreateLabel("Forward Air Tool Actions", 30, 20)
$systeminfobutton = GUICtrlCreateButton("Get System Info", 10, 50, 170)
$bookbutton = GUICtrlCreateButton("Book Shipments on Forward Air", 10, 80, 170)
$linkbutton = GUICtrlCreateButton("Link FWDN Refs in Export", 10, 110, 170)
$trackbutton = GUICtrlCreateButton("Track Forward Air Bills", 10, 140, 170)
$opentool = GUICtrlCreateButton("Open Excel Tool", 10, 170, 170)
$setuptool = GUICtrlCreateButton("User Setup", 10, 200, 170)
$AboutMenu = GUICtrlCreateMenu("&About")
$AboutItem = GUICtrlCreateMenuItem("This Program is not intended for Complete Shipments!", $AboutMenu)
GUISetState(@SW_SHOW)
Func _pause()
Do
Sleep(100)
Until StringInStr(ControlGetText($exportwindow,"", "[CLASS:TStatusBar; INSTANCE:1]"), "Ready")
EndFunc
Func _abandonchange()
    If StringInStr(ControlGetText($exportwindow,"", "[CLASS:TEIMemo; INSTANCE:1]"), "will be lost") Then
    ControlSend($exportwindow,"","TScrollBox1","{F2}")
    _pause()
EndIf
EndFunc
Func _changeevent()
    If StringInStr(ControlGetText($exportwindow,"", "[CLASS:TEIMemo; INSTANCE:1]"), "reason code is required") Then
    ControlSetText($exportwindow, "", "[CLASS:TEIEdit; INSTANCE:2]", "DE")
    ControlSend($exportwindow,"","TScrollBox1","{F1}")
    _pause()
    ControlSend($exportwindow,"","TScrollBox1","{F1}")
    _pause()
    EndIf
EndFunc
Func LoadSQLFile($p_FilePath)
    Local $l_strFinal, $l_File
    $l_File = FileOpen($p_FilePath, 0)
    $l_strFinal = FileRead($l_File)
    FileClose($l_File)
    return $l_strFinal
EndFunc
Func ConnectToETMS($p_branch, $p_user, $p_password)
    Local $l_objConn
    $l_objConn = ObjCreate("ADODB.Connection")
    if @error = 1 then return ''
    $l_objConn.Open("DRIVER={IBM DB2 ODBC DRIVER};HOSTNAME=" & $p_branch & "." & $p_branch & ".ei;PORT=50000;DATABASE=" & $p_branch & ";PROTOCOL=TCPIP;UID=" & $p_user & ";PWD=" & $p_password)
    if $l_objConn.State = 0 then return ''
    return $l_objConn
EndFunc
Func QueryToArray($p_connection, $p_query)
    Local $i, $j, $l_objQuery, $l_result
    $l_objQuery = ObjCreate("ADODB.Recordset")
    if @error = 1 then return ''
    $l_objQuery.Open($p_query, $p_connection)
    if $l_objQuery.State = 0 then return ''
    Dim $l_result[1][$l_objQuery.Fields.Count]
    For $j = 0 to $l_objQuery.Fields.Count - 1
        $l_result[0][$j] = $l_objQuery.Fields($j).Name
    Next
    $i = 1
    if $l_objQuery.EOF then return $l_result
    Do
        For $j = 0 To $l_objQuery.Fields.Count - 1
            if $i < UBound($l_result) Then
                $l_result[$i][$j] = $l_objQuery.Fields.Item($j).value
            Else
                ReDim $l_result[Ubound($l_result, 1) + 1][$l_objQuery.Fields.Count]
                $l_result[$i][$j] = $l_objQuery.Fields.Item($j).value
            EndIf
        Next
        $l_objQuery.MoveNext
        $i = $i + 1
    Until $l_objQuery.EOF
    return $l_result
EndFunc
Func CloseConnection($p_connection)
    Return $p_connection.Close
EndFunc
$row = 3
;$value = InputBox("Forward Air Bulk Book Script", @LF &  " ENTER ACTION TO PERFORM"&@lf&@LF&"  1.  Get System Information"&@lf&"  2.  Book Shipments on Forward Air"&@lf&"  3.  Assign Pro to Consol"&@lf&"  4.  Track Shipments on FWDN site"&@lf&"  5.  User Setup "&@LF&" ", "*", " M1", "", 220)
;If @error = 1 Then Exit ; Cancel button pressed
While 1
  Switch GUIGetMsg()
    Case $systeminfobutton     ;;Get System information from database
            $oExcel = _ExcelBookOpen($filelocation & "bulkbook.xlsm")
            TrayTip("Script", "Opening Bulkbook.", 10)
            $serverbranch = _ExcelReadCell($oExcel, 2, 17)
            $inputsarray = _ExcelReadSheetToArray($oExcel, 1, 1, 0) ;Read 1 Columns
            TrayTip("Script", "Reading Consols from sheet.", 10)
            $counter = $inputsarray[0][0]
            $excelstartrow = 3
            $endsqlquery = ""
            $front = "'"
            $back = "',"
                Do
                    $consol = $inputsarray[$excelstartrow][1]
                    $excelstartrow = $excelstartrow + 1
                    $endsqlquery = $endsqlquery & $front & $consol & $back
                Until $excelstartrow = $counter + 1
            $endsqlquery = StringTrimRight($endsqlquery, 1)
            ;;;connecting to ETMS to run dims query
            TrayTip("Script", "Connecting to database.", 10)
            $oConn = ConnectToETMS($serverbranch, '', '')
            ;$query = LoadSQLFile('etms_consol_dims.sql')
            $query = $sqlquerybase & $endsqlquery & ")"
            TrayTip("Script", "Executing query.", 10)
            $results = QueryToArray($oConn, $query)
            CloseConnection($oConn)
            ;;;array manipulation to enter all instances into a row by pcs, len, wid, hgt for each onhand
            $counter = $inputsarray[0][0]
            $excelstartrow = 3
            Do
            $currentconsol = $inputsarray[$excelstartrow][1]
            $found = _ArrayFindAll($results, $currentconsol, 0, 0, 0, 1)
            $searchcount = UBound($found)
            $foundstart = 0
            $pcsstart = 22
            $lenstart = 23
            $widstart = 24
            $hgtstart = 25
                    For $i = 1 To $searchcount Step 1
                    $searchrow = $found[$foundstart]
                    $pcs = $results[$searchrow][3]
                    $len = $results[$searchrow][4]
                    If $len = 0 Then $len = 20
                    $wid = $results[$searchrow][5]
                    If $wid = 0 Then $wid = 20
                    $hgt = $results[$searchrow][6]
                    If $hgt = 0 Then $hgt = 20
                    _ExcelWriteCell($oExcel, $pcs, $excelstartrow, $pcsstart)
                    _ExcelWriteCell($oExcel, $len, $excelstartrow, $lenstart)
                    _ExcelWriteCell($oExcel, $wid, $excelstartrow, $widstart)
                    _ExcelWriteCell($oExcel, $hgt, $excelstartrow, $hgtstart)
                    $foundstart = $foundstart + 1
                    $pcsstart = $pcsstart + 4
                    $lenstart = $lenstart + 4
                    $widstart = $widstart + 4
                    $hgtstart = $hgtstart + 4
                Next
                $origin = $results[$searchrow][7]
                $destin = $results[$searchrow][8]
                $totalpcs = $results[$searchrow][10]
                $consol_act_wgt = $results[$searchrow][11]
                _ExcelWriteCell($oExcel, $origin, $excelstartrow, 4)
                _ExcelWriteCell($oExcel, $destin, $excelstartrow, 5)
                _ExcelWriteCell($oExcel, $totalpcs, $excelstartrow, 3)
                _ExcelWriteCell($oExcel, $consol_act_wgt, $excelstartrow, 2)
                _ExcelWriteCell($oExcel, "FREIGHT ALL KINDS", $excelstartrow, 6)
            $excelstartrow = $excelstartrow + 1
            Until $excelstartrow = $counter + 1
            MsgBox("Script Completion", "Consol Information Entered", "Exiting Script")
    Case $bookbutton
            ;;Book Shipments on Web
            $row = 3
            $webuser = InputBox("Forward Air Bulk Book Script", @LF & @LF &"    ENTER WEBSITE USERNAME")
            If @error = 1 Then Exit ; Cancel button pressed
            $webpw = InputBox("Forward Air Bulk Book Script",@LF & @LF & "  ENTER Password")
            If @error = 1 Then Exit ; Cancel button pressed
            Do
            $date = InputBox("Forward Air Bulk Book Script", @lf & "  ENTER date booking freight" & @LF & @LF & "  ENTER in mm/dd/yyyy format")
            If @error = 1 Then Exit ; Cancel button pressed
            Until StringLen($date) = 10
            $oExcel = _ExcelBookOpen($filelocation & "bulkbook.xlsm")
            $aArray = _ExcelReadSheetToArray($oExcel)
            _ArrayDisplay($aArray)
            $currentbranch = $aArray[2][17]
            $counter = $aArray[0][0]
            $columnstop = $aArray[0][1]
            ReDim $aArray[$counter + 1][$columnstop + 5]
            $first = _ExcelReadCell($oExcel, 2, 18)
            $last = _ExcelReadCell($oExcel, 2, 19)
            $user = $first & " " & $last
            $uphone  = _ExcelReadCell($oExcel, 2, 21)
            $uemail  = _ExcelReadCell($oExcel, 2, 20)
            $oIE = _IECreate("http://forwardair.com",0,1,1)
            WinSetState("Welcome to Forward Air Home Page - Windows Internet Explorer", "", @SW_MAXIMIZE)
            $oForm = _IEFormGetObjByName($oIE, "loginForm");enter the form id or name
            $uname = _IEFormElementGetObjByName($oForm, "UserName")
            $pw = _IEFormElementGetObjByName($oForm, "Password")
            _IEFormElementSetValue($uname, $webuser);;;;;ENTER PASSWORD
            _IEFormElementSetValue($pw, $webpw)
            $login = _IEGetObjByName($oIE,"B1")
            _IEAction($login, "click")
            MsgBox("", "", "clicked")
            _IELoadWait($oIE)
            MsgBox("", "", "after load")

        Do
            _IENavigate($oIE, "http://forwardair.com/servlet/fwrd.unix.servlet.StartOnlineShippingServlet",1)
            _IELoadWait($oIE)
            MsgBox("", "", "reached page")
            $c1 = 1
            $c2 = 3
            $c3 = 2
            $c4 = 4
            $c5 = 5
            $c6 = 6
            $c7 = 7
            $c8 = 8
            $c9 = 9
            $c10 = 10
            $c11 = 11
            $c12 = 12
            $c13 = 13
            $c14 = 14
            $c15 = 15
            $c16 = 16
            $c17 = 17
            $c18 = 18
            $c19 = 19
            $c20 = 20
            $c21 = 21
            $floating_plt = 22
            $floating_L = 23
            $floating_W = 24
            $floating_H = 25
            _IELoadWait($oIE)
            ;;SET VARIABLE FROM EXCEL ARRAY
            $eiref = $aArray[$row][$c1]
            $pcs = $aArray[$row][$c2]
            $wgt = $aArray[$row][$c3]
            $origin = $aArray[$row][$c4]
            $dest = $aArray[$row][$c5]
            $type =  $aArray[$row][$c6]
            $special =  $aArray[$row][$c8]
            $destoffice = "Expeditors International " & $dest
            ;;variables set from current row in excel book
            $shipForm = _IEFormGetObjByName($oIE, "onlineShipping")
            $forg = _IEFormElementGetObjByName($shipForm, "origin");;;;;;;;;;DROP DOWN BOX EXAMPLE
            $fdest = _IEFormElementGetObjByName($shipForm, "destination")
            $goods = _IEFormElementGetObjByName($shipForm, "description")
            $shipdate = _IEFormElementGetObjByName($shipForm, "shipmentDate1")
            $fpieces = _IEFormElementGetObjByName($shipForm, "pieces")
            $fwgt = _IEFormElementGetObjByName($shipForm, "weight")
            $ref1 = _IEFormElementGetObjByName($shipForm, "referenceNumber_0")
            $instr = _IEFormElementGetObjByName($shipForm, "instructions")
            $continue = _IEGetObjByName($oIE, "B1")
            _IEFormElementSetValue($shipdate, $date)
            _IEFormElementOptionSelect($forg, $origin, 1, "byValue")
            _IEFormElementOptionSelect($fdest, $dest, 1, "byValue")
            _IEFormElementSetValue($fpieces, $pcs)
            _IEFormElementSetValue($fwgt, $wgt)
            _IEFormElementSetValue($goods, $type)
            _IEFormElementRadioSelect($shipForm, "rHazmatNo", "rHazmat")
            _IEFormElementRadioSelect($shipForm, "rInbondNo", "rInbond")
            _IEFormElementSetValue($ref1, $eiref)
            _IEFormElementSetValue($instr, $special);;;;;;entering dims section
            _IELinkClickByText($oIE, "Enter Dims")
            _IELoadWait($oIE)
            $dimpieces = _IEFormElementGetObjByName($shipForm, "dimpieces")
            $dimlength = _IEFormElementGetObjByName($shipForm, "dimlength")
            $dimwidth = _IEFormElementGetObjByName($shipForm, "dimwidth")
            $dimheight = _IEFormElementGetObjByName($shipForm, "dimheight")
            $clickit = _IEGetObjByName($shipForm, "Clickit")
            Do
                $faplt = $aArray[$row][$floating_plt]
                $faL = $aArray[$row][$floating_L]
                $faW = $aArray[$row][$floating_W]
                $faH = $aArray[$row][$floating_H]
                    Do
                        Sleep(100)
                    Until _IEFormElementGetValue($dimheight) = 0
                If $faplt >= 1 Then _IEFormElementSetValue($dimpieces, $faplt)
                If $faplt >= 1 then _IEFormElementSetValue($dimlength, $faL)
                If $faplt >= 1 then _IEFormElementSetValue($dimwidth, $faW)
                If $faplt >= 1 then _IEFormElementSetValue($dimheight, $faH)
                If $faplt >= 1 then _IEAction($clickit, "click")
                $floating_plt = $floating_plt + 4
                $floating_L = $floating_L + 4
                $floating_W = $floating_W + 4
                $floating_H = $floating_H + 4
                Until $faplt < 1 ;;;;dims entering stops
            If not ProcessExists("popup.exe") Then Run("popup.exe", "")
            _IEAction($continue, "click")
            _IELoadWait($oIE);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;On Shipment info Screen
            $onlineshipping = _IEFormGetObjByName($oIE, "onlineShipping")
            $fwdntable = _IETableGetCollection($oIE, 8)
            $fwdnarray = _IETableWriteToArray($fwdntable, True)
            $fwtender = StringStripWS($fwdnarray[4][1], 3)
            $fweta = StringStripWS($fwdnarray[5][1], 3)
            _ExcelWriteCell($oExcel, $fwtender, $row, 10)
            _ExcelWriteCell($oExcel, $fweta, $row, 11)
            $next = _IEGetObjByName($oIE, "B1")
            _IEAction($next, "click")
            _IELoadWait($oIE);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;On Consignee info Screen
            $consigneeform = _IEFormGetObjByName($oIE, "shipperConsigneeInfo")
            $sphone = _IEFormElementGetObjByName($consigneeform, "sphone")
            $scontact = _IEFormElementGetObjByName($consigneeform, "scontact")
            $semail = _IEFormElementGetObjByName($consigneeform, "semail")
            $scemail = _IEFormElementGetObjByName($consigneeform, "scemail")
            $cname = _IEFormElementGetObjByName($consigneeform, "cname")
            $caddress1 = _IEFormElementGetObjByName($consigneeform, "caddress1")
            $caddress2 = _IEFormElementGetObjByName($consigneeform, "caddress2")
            $ccity = _IEFormElementGetObjByName($consigneeform, "ccity")
            $cprovincestate = _IEFormElementGetObjByName($consigneeform, "cprovincestate")
            $czip = _IEFormElementGetObjByName($consigneeform, "czip")
            $ccountry = _IEFormElementGetObjByName($consigneeform, "ccountry")
            $cphone = _IEFormElementGetObjByName($consigneeform, "cphone")
            $ccontact = _IEFormElementGetObjByName($consigneeform, "ccontact")
            $emrgyContact = _IEFormElementGetObjByName($consigneeform, "emrgyContact")
            $emrgyPhone = _IEFormElementGetObjByName($consigneeform, "emrgyPhone")
            $emrgyEmail = _IEFormElementGetObjByName($consigneeform, "emrgyEmail")
            $con_go = _IEGetObjByName($consigneeform, "B1")
            ;;;setting consigneeformvalues
            _IEFormElementSetValue($sphone, $uphone)
            _IEFormElementSetValue($scontact, $user)
            _IEFormElementSetValue($semail, $uemail)
            _IEFormElementSetValue($scemail, $uemail)
            _IEFormElementSetValue($cname, $destoffice)
            _IEFormElementSetValue($caddress1, "Notify on Arrival")
            _IEFormElementSetValue($ccity, $dest)
            _IEFormElementSetValue($czip, "99999")
            _IEFormElementSetValue($cphone, $uphone)
            _IEFormElementSetValue($ccontact, "Transcon")
            _IEFormElementSetValue($emrgyContact, $user)
            _IEFormElementSetValue($emrgyPhone, $uphone)
            _IEFormElementSetValue($emrgyEmail,"DCS-IN-"&$currentbranch&"@EXPEDITORS.COM")
            _IEAction($con_go, "click")
            _ieloadwait($oIE)
            ;;;;shipment summary form
            $shipsummaryform = _IEFormGetObjByName($oIE, "onlineShipmentSummary")
            _IEFormElementCheckBoxSelect($shipsummaryform, "yes", "agree", 1, "byValue")
            $finalgo = _IEGetObjByName($shipsummaryform, "B1")
            If not ProcessExists("popup.exe") Then Run("popup.exe", "")
            _IEAction($finalgo, "click")
            _IELoadWait($oIE)
            $bookingform = _IEFormGetObjByName($oIE, "premierShipmentBooking")
            $finaltable = _IETableGetCollection($oIE, 8)
            $finalarray = _IETableWriteToArray($finaltable, True)
            $chargetable = _IETableGetCollection($oIE, 10)
            $chargearray = _IETableWriteToArray($chargetable, True);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;check array
            $chargerow = _ArraySearch($chargearray, "Total Charges:", 0, 0, 0, 1)
            $fastbook = $finalarray[6][1]
            $edocnumber = $finalarray[8][1]
            $fwdncharges = $chargearray[$chargerow][1]
            $print = _IEFormElementGetObjByName($bookingform, "pdfButton")
            _IEAction($print, "click")
            _ExcelWriteCell($oExcel, $fastbook, $row, 9)
            _ExcelWriteCell($oExcel, $fwdncharges, $row, 13)
            If ProcessExists("popup.exe") Then ProcessClose("popup.exe")
            WinActivate("http://forwardair.com/servlet/fwrd.unix.servlet.GetAirbillPDFServlet - Windows Internet Explorer")
            sleep(5000)
            ;;;go to airbill print
            Send("{CTRLDOWN}")
            Send("{p}")
            Send("{CTRLUP}")
            WinWaitActive("Print")
            Send("{ENTER}")
            WinWaitActive("Output Source")
            Send("{Enter}")
            WinClose("http://forwardair.com/servlet/fwrd.unix.servlet.GetAirbillPDFServlet - Windows Internet Explorer")
            WinWait("Print2edoc")
            $edoc = WinGetTitle("Print2edoc")
            $checkbillforedoc = StringLeft($edocnumber, 3)
            If $currentbranch = $checkbillforedoc Then ControlSend($edoc, "", "[CLASS:TComboBox; INSTANCE:2]", "CONSOL")
            If $currentbranch <> $checkbillforedoc Then ControlSend($edoc, "", "[CLASS:TComboBox; INSTANCE:2]", "HOUSE_BILL")
            ClipPut($eiref)
            ControlSetText($edoc, "", "[CLASS:TScaleMemo; INSTANCE:2]", $eiref)
            ControlSend($edoc, "", "[CLASS:TComboBox; INSTANCE:1]", "Truck Bill")
            ControlClick($edoc, "Send", "[CLASS:TButton; INSTANCE:2]", "left", "1")
            ControlClick($edoc, "", "[CLASS:TButton; INSTANCE:2]")
            ;WinWaitActive("http://forwardair.com/servlet/fwrd.unix.servlet.GetAirbillPDFServlet - Windows Internet Explorer")
            ;$ieclose = WinGetTitle("http://forwardair.com/servlet/fwrd.unix.servlet.GetAirbillPDFServlet - Windows Internet Explorer")
            $row = $row + 1
        Until $row = $counter + 1
            sleep(3000)
            MsgBox("","", "Script Completed"&@lf&""&@lf&"Check All Data Before Linking IC's")
    Case $linkbutton              ;;Link Shipments in Export
    ;;;;Setting booked pro's to Consol Screen
        $row = 3
        MsgBox("Alert", "Instructions", "Please have Export set to blank LOG Screen" &@LF& "before continuing with assigning FWDN pro's")
        $oExcel = _ExcelBookOpen($filelocation & "bulkbook.xlsm")
        $aArray = _ExcelReadSheetToArray($oExcel)
        $counter = $aArray[0][0]
        $currentbranch = $aArray[2][17]
        $exportinitials = $aArray[2][16]
        $exportwindow = "EXPORT " & StringLower($currentbranch) & "." & StringLower($currentbranch) & ".ei " & $exportinitials
        Do
        IF WinExists($exportwindow & ".EXPORT (LOG)") Then
            $eiref = StringStripWS($aArray[$row][1],3)
            $fwdnpro = $aArray[$row][9]
            $origin = $aArray[$row][4]
            $dest = $aArray[$row][5]
            $BKTDATE = $aArray[$row][10]
            $ETADATE = $aArray[$row][11]
            WinActivate($exportwindow & ".EXPORT (LOG)")
            ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:77]", $eiref)
            ControlSend($exportwindow,"","TScrollBox1","{F2}")
            _pause()
            _abandonchange()
            $checkconsol = ControlGetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:64]")
                If $checkconsol = $eiref then
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:71]", "FWDN-" & $fwdnpro)
                    ControlSend($exportwindow,"","TScrollBox1","{F1}")
                    _pause()
                    ControlSend($exportwindow,"","TScrollBox1","{F1}")
                    _pause()
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:77]", "HIST")
                    ControlSend($exportwindow,"","TScrollBox1","{F8}")
                    _pause()
                    _abandonchange()
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:198]", "BKT")
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:197]", $BKTDATE)
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:196]", "2300")
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:195]", $origin)
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:194]", $dest)
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:193]", "RFS")
                    ControlSend($exportwindow,"","TScrollBox1","{F1}")
                    _pause()
                    _changeevent()
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:198]", "ETA")
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:197]", $ETADATE)
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:196]", "1000")
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:195]", $origin)
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:194]", $dest)
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:193]", "RFS")
                    ControlSend($exportwindow,"","TScrollBox1","{F1}")
                    _pause()
                    _changeevent()
                    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:207]", "LOG")
                    ControlSend($exportwindow,"","TScrollBox1","{F8}")
                    _pause()
                    _abandonchange()
                    $linkcheck = "FWDN-" & $fwdnpro
                EndIf
            Else
                MsgBox(0x10000,"Error","Open an EXPORT LOG screen for " & $exportinitials)
                _ExcelBookClose($oExcel)
            Exit
        EndIf
                If StringStripWS(ControlGetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:71]"), 3) = $linkcheck Then
                _ExcelWriteCell($oExcel, "Yes", $row, 12)
                EndIf
            $row = $row + 1
        Until $row = $counter + 1
        MsgBox("Script Complete", "FWDN pro's assigned", "Script Completed")
    Case $trackbutton          ;;Track Shipments on Web
            $row = 3
            $webuser = InputBox("Forward Air Bulk Book Script", "   ENTER WEBSITE USERNAME")
            If @error = 1 Then Exit; Cancel button pressed
            $webpw = InputBox("Forward Air Bulk Book Script", " ENTER Password")
            If @error = 1 Then Exit; Cancel button pressed
            $oIE = _IECreate("http://forwardair.com",0, 0)
            $oForm = _IEFormGetObjByName($oIE, "loginForm");enter the form id or name
            $uname = _IEFormElementGetObjByName($oForm, "UserName")
            $pw = _IEFormElementGetObjByName($oForm, "Password")
            _IEFormElementSetValue($uname, $webuser);;;;;ENTER PASSWORD
            _IEFormElementSetValue($pw, $webpw)
            $login = _IEGetObjByName($oIE,"B1")
            _IEAction($login, "click")
            _IELoadWait($oIE)
            $oExcel = _ExcelBookOpen($filelocation & "fwdninput.xlsx")
            $aArray = _ExcelReadSheetToArray($oExcel)
            $counter = $aArray[0][0]
            ;_ExcelSheetActivate($oExcel,"input")
            Do
            _IENavigate($oIE, "http://www.forwardair.com/tnt/fatnt.jsp",1)
            $eirefc = 1
            $pcsc = 2
            $wgtc = 3
            $originc = 4
            $destc = 5
            $specialc = 6
            $eiref = _ExcelReadCell($oExcel, $row, $eirefc)
            $pcs = _ExcelReadCell($oExcel, $row, $pcsc)
            $wgt = _ExcelReadCell($oExcel, $row, $wgtc)
            $origin = _ExcelReadCell($oExcel, $row, $wgtc)
            $dest = _ExcelReadCell($oExcel, $row, $destc)
            $special =  _ExcelReadCell($oExcel, $row, $specialc)
            $oForm = _IEFormGetObjByName($oIE, "QuikTracForm")
            $fwdnref = _IEFormElementGetObjByName($oForm, "ref1")
            _IEFormElementSetValue($fwdnref, $eiref)
            $search = _IEGetObjByName($oIE, "btnTrack")
            _IEAction($search, "click")
            _IELoadWait($oIE)
            $fwdntable = _IETableGetCollection($oIE, 6)
            $fwdnarray = _IETableWriteToArray($fwdntable, True)
            $fwdnstatus = $fwdnarray[1][1]
            $fworigin = $fwdnarray[1][2]
            $fwdest = $fwdnarray[1][3]
            $fwpcs = $fwdnarray[1][4]
            $fwwgt = $fwdnarray[1][5]
            $fwlh = $fwdnarray[1][6]
            $fwpod = $fwdnarray[1][7]
            $fweta = $fwdnarray[1][8]
            $fwcharges = $fwdnarray[1][9]
            _ExcelWriteCell($oExcel, $fwdnstatus, $row, 6)
            _ExcelWriteCell($oExcel, $fworigin, $row, 7)
            _ExcelWriteCell($oExcel, $fwdest, $row, 8)
            _ExcelWriteCell($oExcel, $fwpcs, $row, 9)
            _ExcelWriteCell($oExcel, $fwwgt, $row, 10)
            _ExcelWriteCell($oExcel, $fwlh, $row, 11)
            _ExcelWriteCell($oExcel, $fwpod, $row, 12)
            _ExcelWriteCell($oExcel, $fweta, $row, 13)
            _ExcelWriteCell($oExcel, $fwcharges, $row, 14)
            $row = $row + 1
            Until $row = $counter + 1;Stringlen($eiref) < 1
            MsgBox("","", "Script Completed")
            _IEQuit($oIE)
    Case $GUI_EVENT_CLOSE      ;;Close Gui
        Exit
    Case $setuptool            ;;Update Excel Booking tool
        $oExcel = _ExcelBookOpen($filelocation & "bulkbook.xlsm")
        $branch = StringUpper(InputBox("Worksheet set-up", "     Enter your Branch"))
        If @error = 1 Then Exit; Cancel button pressed
        $exportinitials = StringUpper(InputBox("Worksheet set-up", "     Enter your export initials"))
        If @error = 1 Then Exit; Cancel button pressed
        $first = StringUpper(InputBox("Worksheet set-up", "     Enter your first name"))
        If @error = 1 Then Exit; Cancel button pressed
        $last = StringUpper(InputBox("Worksheet set-up", "     Enter your last name"))
        If @error = 1 Then Exit; Cancel button pressed
        $email = StringUpper(InputBox("Worksheet set-up", "     Enter your email address"))
        If @error = 1 Then Exit; Cancel button pressed
        $phone = StringUpper(InputBox("Worksheet set-up", "     Enter your 10 digit Dept. phone#" &@lf&@lf& "     ex. 8885001234"))
        If @error = 1 Then Exit ; Cancel button pressed
        _ExcelWriteCell($oExcel, $branch, 2, 17)
        _ExcelWriteCell($oExcel, $exportinitials, 2, 16)
        _ExcelWriteCell($oExcel, $first, 2, 18)
        _ExcelWriteCell($oExcel, $last, 2, 19)
        _ExcelWriteCell($oExcel, $email, 2, 20)
        _ExcelWriteCell($oExcel, $phone, 2, 21)
        MsgBox("Set-up Complete", "User info Updated", "Check info boxes")
    Case $opentool
        $oExcel = _ExcelBookOpen($filelocation & "bulkbook.xlsm")
    EndSwitch
WEnd

#cs


All the old values before Gui options



If $value = 4 Then;;TRACK SHIPMENTS AND GET INFO ON FWDN SITE;;;;;;;;;;;;;;;;;;;;4
$webuser = InputBox("Forward Air Bulk Book Script", "   ENTER WEBSITE USERNAME")
If @error = 1 Then Exit ; Cancel button pressed
$webpw = InputBox("Forward Air Bulk Book Script", " ENTER Password")
If @error = 1 Then Exit ; Cancel button pressed
$oIE = _IECreate("http://forwardair.com",0, 0)
$oForm = _IEFormGetObjByName($oIE, "loginForm");enter the form id or name
$uname = _IEFormElementGetObjByName($oForm, "UserName")
$pw = _IEFormElementGetObjByName($oForm, "Password")
_IEFormElementSetValue($uname, $webuser);;;;;ENTER PASSWORD
_IEFormElementSetValue($pw, $webpw)
$login = _IEGetObjByName($oIE,"B1")
_IEAction($login, "click")
_IELoadWait($oIE)
$oExcel = _ExcelBookOpen($filelocation & "fwdninput.xlsx")
$aArray = _ExcelReadSheetToArray($oExcel)
$counter = $aArray[0][0]
;_ExcelSheetActivate($oExcel,"input")
Do
_IENavigate($oIE, "http://www.forwardair.com/tnt/fatnt.jsp",1)
$eirefc = 1
$pcsc = 2
$wgtc = 3
$originc = 4
$destc = 5
$specialc = 6
$eiref = _ExcelReadCell($oExcel, $row, $eirefc)
$pcs = _ExcelReadCell($oExcel, $row, $pcsc)
$wgt = _ExcelReadCell($oExcel, $row, $wgtc)
$origin = _ExcelReadCell($oExcel, $row, $wgtc)
$dest = _ExcelReadCell($oExcel, $row, $destc)
$special =  _ExcelReadCell($oExcel, $row, $specialc)
$oForm = _IEFormGetObjByName($oIE, "QuikTracForm")
$fwdnref = _IEFormElementGetObjByName($oForm, "ref1")
_IEFormElementSetValue($fwdnref, $eiref)
$search = _IEGetObjByName($oIE, "btnTrack")
_IEAction($search, "click")
_IELoadWait($oIE)
$fwdntable = _IETableGetCollection($oIE, 6)
$fwdnarray = _IETableWriteToArray($fwdntable, True)
$fwdnstatus = $fwdnarray[1][1]
$fworigin = $fwdnarray[1][2]
$fwdest = $fwdnarray[1][3]
$fwpcs = $fwdnarray[1][4]
$fwwgt = $fwdnarray[1][5]
$fwlh = $fwdnarray[1][6]
$fwpod = $fwdnarray[1][7]
$fweta = $fwdnarray[1][8]
$fwcharges = $fwdnarray[1][9]
_ExcelWriteCell($oExcel, $fwdnstatus, $row, 6)
_ExcelWriteCell($oExcel, $fworigin, $row, 7)
_ExcelWriteCell($oExcel, $fwdest, $row, 8)
_ExcelWriteCell($oExcel, $fwpcs, $row, 9)
_ExcelWriteCell($oExcel, $fwwgt, $row, 10)
_ExcelWriteCell($oExcel, $fwlh, $row, 11)
_ExcelWriteCell($oExcel, $fwpod, $row, 12)
_ExcelWriteCell($oExcel, $fweta, $row, 13)
_ExcelWriteCell($oExcel, $fwcharges, $row, 14)
$row = $row + 1
Until $row = $counter + 1;Stringlen($eiref) < 1
MsgBox("","", "Script Completed")
_IEQuit($oIE)
EndIf






If $value = 5 Then;;USER SETUP PORTION OF SCRIPT
$oExcel = _ExcelBookOpen($filelocation & "bulkbook.xlsm")
$branch = StringUpper(InputBox("Worksheet set-up", "     Enter your Branch"))
If @error = 1 Then Exit; Cancel button pressed
$exportinitials = StringUpper(InputBox("Worksheet set-up", "     Enter your export initials"))
If @error = 1 Then Exit ; Cancel button pressed
$first = StringUpper(InputBox("Worksheet set-up", "     Enter your first name"))
If @error = 1 Then Exit ; Cancel button pressed
$last = StringUpper(InputBox("Worksheet set-up", "     Enter your last name"))
If @error = 1 Then Exit ; Cancel button pressed
$email = StringUpper(InputBox("Worksheet set-up", "     Enter your email address"))
If @error = 1 Then Exit ; Cancel button pressed
$phone = StringUpper(InputBox("Worksheet set-up", "     Enter your 10 digit Dept. phone#" &@lf&@lf& "     ex. 8885001234"))
If @error = 1 Then Exit ; Cancel button pressed
_ExcelWriteCell($oExcel, $branch, 2, 17)
_ExcelWriteCell($oExcel, $exportinitials, 2, 16)
_ExcelWriteCell($oExcel, $first, 2, 18)
_ExcelWriteCell($oExcel, $last, 2, 19)
_ExcelWriteCell($oExcel, $email, 2, 20)
_ExcelWriteCell($oExcel, $phone, 2, 21)
MsgBox("Set-up Complete", "User info Updated", "Check info boxes")
EndIf




If $value = 99 Then;;;;;;;;;;;;;;;;;;;;;;;EXPORT SCRIPT THAT WAS REPLACED WITH THE DATABASE LOOK UP IN OPTION 1
$oExcel = _ExcelBookOpen($filelocation & "bulkbook.xlsm")
$aArray = _ExcelReadSheetToArray($oExcel)
$counter = $aArray[0][0]
$currentbranch = $aArray[2][17]
$exportinitials = $aArray[2][16]
$gci = "GCI"
$pltcol = 264
$pcstypecol = 263
$lcol = 261
$wcol = 260
$hcol = 259
$wgtcol = 256
$sheetpcs = 22;;;DFWT011267
$sheetL = 23
$sheetW = 24
$sheetH = 25
$totalchargewgt = 0
$checkedpcs = 0
$exportwindow = "EXPORT " & StringLower($currentbranch) & "." & StringLower($currentbranch) & ".ei " & $exportinitials
Do
IF WinExists($exportwindow & ".EXPORT (LOG)") Then
    ControlSetText("EXPORT " & $currentbranch,"", "[CLASS:TEIEdit; INSTANCE:77]", "LOG X")
    ControlSend($exportwindow,"","TScrollBox1","{F8}")
    _pause()
    _abandonchange()
    $eiref = $aArray[$row][1]
    WinActivate($exportwindow)
    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:77]", $eiref)
    ControlSend($exportwindow,"","TScrollBox1","{F2}")
    _pause()
    $org = ControlGetText($exportwindow, "", "[CLASS:TEIEdit; INSTANCE:73]")
    $dest = ControlGetText($exportwindow, "", "[CLASS:TEIEdit; INSTANCE:70]")
    $pcs = ControlGetText($exportwindow, "", "[CLASS:TEIEdit; INSTANCE:7]")
    $consolwgt = ControlGetText($exportwindow, "", "[CLASS:TEIEdit; INSTANCE:3]")
    $descrip = ControlGetText($exportwindow, "", "[CLASS:TEIEdit; INSTANCE:55]")
    _ExcelWriteCell($oExcel, $pcs, $row, 3)
    _ExcelWriteCell($oExcel, $org, $row, 4)
    _ExcelWriteCell($oExcel, $dest, $row, 5)
    _ExcelWriteCell($oExcel, $consolwgt, $row, 2)
    _ExcelWriteCell($oExcel, "Freight All Kinds", $row, 6)
    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:77]", "DIMS " & $eiref)
    ControlSend($exportwindow,"","TScrollBox1","{F8}")
    _pause()
    WinWaitActive($exportwindow)
    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:6]", "OHT")
    ControlSend($exportwindow,"","TScrollBox1","{F2}")
    _pause()
    WinWaitActive($exportwindow)
        Do
            Do
                $plt = ControlGetText($exportwindow,"","[CLASS:TEIEdit; INSTANCE:" & $pltcol & "]")
                $plt = Int(StringStripWS($plt, 3))
                $pcs = ControlGetText($exportwindow,"","[CLASS:TEIEdit; INSTANCE:" & $pcstypecol & "]")
                $l = ControlGetText($exportwindow,"","[CLASS:TEIEdit; INSTANCE:" & $lcol & "]")
                $l = Int(StringStripWS($l, 3))
                $w = ControlGetText($exportwindow,"","[CLASS:TEIEdit; INSTANCE:" & $wcol & "]")
                $w = Int(StringStripWS($w, 3))
                $h = ControlGetText($exportwindow,"","[CLASS:TEIEdit; INSTANCE:" & $hcol & "]")
                $h = Int(StringStripWS($h, 3))
                $wt = ControlGetText($exportwindow,"","[CLASS:TEIEdit; INSTANCE:" & $wgtcol & "]")
                $wt = Int(StringStripWS($wt, 3))
                $chrgwgt = (($plt*($l * $w * $h))/250)
                $totalchargewgt = $totalchargewgt + $chrgwgt
                $checkedpcs = $plt + $checkedpcs
                If $plt >= 1 Then _ExcelWriteCell($oExcel, $plt, $row, $sheetpcs)
                If $plt >= 1 Then _ExcelWriteCell($oExcel, $l, $row, $sheetL)
                If $plt >= 1 Then _ExcelWriteCell($oExcel, $w, $row, $sheetW)
                If $plt >= 1 Then _ExcelWriteCell($oExcel, $h, $row, $sheetH)
                ;MsgBox("", "1st line", $plt&@lf&$pcs&@lf&$l&@lf&$w&@lf&$h&@lf&$wt&@lf&$chrgwgt)
                $pltcol = $pltcol - 12
                $pcstypecol = $pcstypecol - 12
                $lcol = $lcol - 12
                $wcol = $wcol - 12
                $hcol = $hcol - 12
                $wgtcol = $wgtcol - 12
                If $plt >= 1 Then $sheetpcs = $sheetpcs + 4
                If $plt >= 1 Then $sheetL = $sheetL + 4
                If $plt >= 1 Then $sheetW = $sheetW + 4
                If $plt >= 1 Then $sheetH = $sheetH + 4
            Until $plt < 1
            ControlSend("EXPORT ","","TScrollBox1","{F5}")
            _pause()
            $pltcol = 264
            $pcstypecol = 265
            $lcol = 261
            $wcol = 260
            $hcol = 259
            $wgtcol = 256
            $consoldone = ControlGetText($exportwindow,"","[CLASS:TEIEdit; INSTANCE:272]")
            $consoldone = StringStripWS($consoldone, 3)
    Until $consoldone = $eiref Or WinExists($exportwindow & ".EXPORT (LOG)") Or $consoldone = "NEXT"
    _ExcelWriteCell($oExcel, $totalchargewgt, $row, 14)
    _ExcelWriteCell($oExcel, $checkedpcs, $row, 15);;;;;;;;;RESETING SHEET COORDINATES AFTER CONSOL IS JUDGED.
    $checkedpcs = 0
    $totalchargewgt = 0
    $sheetpcs = 22
    $sheetL = 23
    $sheetW = 24
    $sheetH = 25
    ;MsgBox("", "", "CONSOL COMPLETE")
    ControlSetText($exportwindow,"", "[CLASS:TEIEdit; INSTANCE:272]", "LOG X")
    _abandonchange()
    If WinExists($exportwindow & ".EXPORT (LOG)") Then ControlSetText("EXPORT " & StringLower($currentbranch),"", "[CLASS:TEIEdit; INSTANCE:77]", "LOG X")
    _abandonchange()
    ControlSend($exportwindow,"","TScrollBox1","{F8}")
    _pause()
    WinWaitActive($exportwindow)
    Else
        MsgBox(0x10000,"Error","Open an EXPORT LOG screen for " & $exportinitials)
        _ExcelBookClose($oExcel)
        Exit
    EndIf
    $row = $row + 1
Until $row = $counter + 1
MsgBox("","Shipment Data complete", "Information pulled Exiting Script!")
EndIf
#ce


;_ExcelWriteCell($oExcel, $gci & @MON & @MDAY & @YEAR, $row, 8)
Edited by dar100111
Link to comment
Share on other sites

Yes I actually took that out.  This was my first autoit script.  There are several redundant places in here.  This is a good opportunity to clean my script up while I'm troubleshooting the issue.  Although I don't know what to do about the functionality of the _IELoadWait after my button clicks.  Is there another easy way to accomplish without having to put sleeps? 

Edited by dar100111
Link to comment
Share on other sites

  • Solution

Something isn't responding the same way on this website as before Dan.  I'm running IE 11 now.

I'll test it further but I may have to put some logic in place to wait until one of the elements on the page I'm ending up at after the button click show up.  I'd feel more confident of that rather than putting a sleep in there.

It's going to the next page but IE isn't loading when it's working.  I tested out another script I have the the load wait function is working ok in that one on a clock in script on our companies site.  I'll have to find a work around.  Thanks for the help!

Edited by dar100111
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...