Jump to content

Is a Window considered Active While Dragging?


Recommended Posts

Hey All,

 

Encountered a strange problem with a loop I have that's adding a variable that keeps adding while I'm dragging the window around. 

I was curious if a Window is considered active while I am dragging it around, or if it waits until it's set to be active?

Thanks!

Link to comment
Share on other sites

Hey FireFox,

I noticed that when I was dragging the screen,  my variables $totalchargewgt and $checkedpcs are in a loop.  When I'm dragging the window around the loop isn't continuing but they keep calculating, so the number keeps getting inflated.  I need to build some sort of safety check so that the loop pauses while the window is being dragged.  Just in case an operator was to do this while running the script.

Thanks!

#include <IE.au3>
#include <Excel.au3>
#include <Array.au3>
#include <Clipboard.au3>

Func _pause()
Do
Sleep(100)
Until StringInStr(ControlGetText("EXPORT ","", "[CLASS:TStatusBar; INSTANCE:1]"), "Ready")
EndFunc


$row = 3
$value = InputBox("Forward Air Bulk Book Script", " ENTER ACTION TO PERFORM"&@lf&@LF&"1.  Get System Information"&@lf&"2.  Book Shipments on Forward Air"&@lf&"3.  Assign Pro to Consol (not finished)"&@lf&"4.  Track Shipments on FWDN site"&@lf&" ", "*", " M1")
If @error = 1 Then Exit ; Cancel button pressed


If $value = 1 Then;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GET SYSTEM INFORMATION;;;;;;;;;;;;;;;;;;;;;;;;1
$oExcel = _ExcelBookOpen("F:\EI\DFW\NAT\Oracle NMC\NMC Development\Network Analyst\Reports\autoit\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
Do
IF WinExists("EXPORT " & StringLower($currentbranch) & "." & StringLower($currentbranch) & ".ei " & $exportinitials & ".EXPORT (LOG)") Then
    $eiref = $aArray[$row][1]
    WinActivate("EXPORT " & StringLower($currentbranch))
    ControlSetText("EXPORT " & StringLower($currentbranch),"", "[CLASS:TEIEdit; INSTANCE:77]", $eiref)
    ControlSend("EXPORT " & StringLower($currentbranch),"","TScrollBox1","{F2}")
    _pause()
    $org = ControlGetText("EXPORT " & StringLower($currentbranch), "", "[CLASS:TEIEdit; INSTANCE:73]")
    $dest = ControlGetText("EXPORT " & StringLower($currentbranch), "", "[CLASS:TEIEdit; INSTANCE:70]")
    $pcs = ControlGetText("EXPORT " & StringLower($currentbranch), "", "[CLASS:TEIEdit; INSTANCE:7]")
    $consolwgt = ControlGetText("EXPORT " & StringLower($currentbranch), "", "[CLASS:TEIEdit; INSTANCE:3]")
    $descrip = ControlGetText("EXPORT " & StringLower($currentbranch), "", "[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("EXPORT " & StringLower($currentbranch),"", "[CLASS:TEIEdit; INSTANCE:77]", "DIMS " & $eiref)
    ControlSend("EXPORT " & StringLower($currentbranch),"","TScrollBox1","{F8}")
    _pause()
    WinWaitActive("EXPORT " & StringLower($currentbranch) & "." & StringLower($currentbranch) & ".ei " & $exportinitials & ".EXPORT (DIMSAL)")
    ControlSetText("EXPORT " & StringLower($currentbranch),"", "[CLASS:TEIEdit; INSTANCE:6]", "OHT")
    ControlSend("EXPORT " & StringLower($currentbranch),"","TScrollBox1","{F2}")
    _pause()
    WinWaitActive("EXPORT " & StringLower($currentbranch) & "." & StringLower($currentbranch) & ".ei " & $exportinitials & ".EXPORT (DIMSA)")
        Do
            Do
                $plt = ControlGetText("EXPORT " & StringLower($currentbranch),"","[CLASS:TEIEdit; INSTANCE:" & $pltcol & "]")
                $plt = Int(StringStripWS($plt, 3))
                $pcs = ControlGetText("EXPORT " & StringLower($currentbranch),"","[CLASS:TEIEdit; INSTANCE:" & $pcstypecol & "]")
                $l = ControlGetText("EXPORT " & StringLower($currentbranch),"","[CLASS:TEIEdit; INSTANCE:" & $lcol & "]")
                $l = Int(StringStripWS($l, 3))
                $w = ControlGetText("EXPORT " & StringLower($currentbranch),"","[CLASS:TEIEdit; INSTANCE:" & $wcol & "]")
                $w = Int(StringStripWS($w, 3))
                $h = ControlGetText("EXPORT " & StringLower($currentbranch),"","[CLASS:TEIEdit; INSTANCE:" & $hcol & "]")
                $h = Int(StringStripWS($h, 3))
                $wt = ControlGetText("EXPORT " & StringLower($currentbranch),"","[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 " & StringLower($currentbranch),"","TScrollBox1","{F5}")
            _pause()
            $pltcol = 264
            $pcstypecol = 265
            $lcol = 261
            $wcol = 260
            $hcol = 259
            $wgtcol = 256
            $consoldone = ControlGetText("EXPORT " & StringLower($currentbranch),"","[CLASS:TEIEdit; INSTANCE:272]")
            $consoldone = StringStripWS($consoldone, 3)
    Until $consoldone = $eiref Or WinExists("EXPORT " & StringLower($currentbranch) & ".dfw.ei DANIELRO.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("EXPORT " & StringLower($currentbranch),"", "[CLASS:TEIEdit; INSTANCE:272]", "LOG X")
    If WinExists("EXPORT " & StringLower($currentbranch) & "." & StringLower($currentbranch) & ".ei " & $exportinitials & ".EXPORT (LOG)") Then ControlSetText("EXPORT " & StringLower($currentbranch),"", "[CLASS:TEIEdit; INSTANCE:77]", "LOG X")
    ControlSend("EXPORT " & StringLower($currentbranch),"","TScrollBox1","{F8}")
    _pause()
    WinWaitActive("EXPORT " & StringLower($currentbranch) & "." & StringLower($currentbranch) & ".ei " & $exportinitials & ".EXPORT (LOG)")
    Else
        MsgBox(0x10000,"Error","Open an EXPORT LOG screen for " & $exportinitials)
        Exit
    EndIf
    $row = $row + 1
Until $row = $counter + 1
MsgBox("","System Information Gathered", "Shipment Info from Export Complete!")
EndIf
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...