Jump to content

Compare values in Excel


Go to solution Solved by ioa747,

Recommended Posts

Posted

I thought this might do the trick, but sadly it doesn't

 

Func Process()
Local $OrderId, $OrderNext, $Reset = False, $index=3
Local $iFrom = $index
While 1
    $Amount = $oWorkbook.ActiveSheet.Cells($iFrom, 9).value
    $OrderId = $oExcel.ActiveWorkBook.ActiveSheet.Cells($index, 3).Value
    If $OrderId = "" Then ExitLoop

    $OrderNext = $oExcel.ActiveWorkBook.ActiveSheet.Cells($index + 1, 3).Value

    
    If $OrderId <> $OrderNext Then
        WinActivate("[Title:Agent Desktop]","")
        Call("SetUp")
        Send($OrderId) ;Send 10 (as the orderID) <-------
        Sleep(100)
        Send("{ENTER}")
        Call ("MoveMountain")               
            For $i = $iFrom to $index
                ;ConsoleWrite($oExcel.ActiveWorkBook.ActiveSheet.Cells($i, 4).Value & "; ")
                kSend($oExcel.ActiveWorkBook.ActiveSheet.Cells($i, 9).Value) 
                kSend ("{DEL 3}")
                if $i < $index or $i = $index Then kSend("{TAB}") ;tab <-------
            Next        
            $iFrom = $i
    ElseIf $OrderId = $OrderNext Then
    Call("CleanUp", $iFrom)
    EndIf
    $index += 1

    WEnd
EndFunc ;==> Process

 

Posted

MsgBox give you the right number? in the right time?

Func Process()
Local $OrderId, $OrderNext, $Reset = False, $index=3
Local $iFrom = $index
While 1
    $Amount = $oWorkbook.ActiveSheet.Cells($iFrom, 9).value
    $OrderId = $oExcel.ActiveWorkBook.ActiveSheet.Cells($index, 3).Value
    If $OrderId = "" Then ExitLoop

    $OrderNext = $oExcel.ActiveWorkBook.ActiveSheet.Cells($index + 1, 3).Value


    If $OrderId <> $OrderNext Then
        WinActivate("[Title:Agent Desktop]","")
        Call("SetUp")
        Send($OrderId) ;Send 10 (as the orderID) <-------
        Sleep(100)
        Send("{ENTER}")
        Call ("MoveMountain")
            For $i = $iFrom to $index
                ;ConsoleWrite($oExcel.ActiveWorkBook.ActiveSheet.Cells($i, 4).Value & "; ")
                kSend($oExcel.ActiveWorkBook.ActiveSheet.Cells($i, 9).Value)
                kSend ("{DEL 3}")
                if $i < $index or $i = $index Then kSend("{TAB}") ;tab <-------
            Next
            $iFrom = $i
            MsgBox($MB_SYSTEMMODAL, "CleanUp", $iFrom) 
    EndIf
    $index += 1

    WEnd
EndFunc ;==> Process

 

I know that I know nothing

Posted (edited)

It doesn't pop up at all...
My first line is a single one, nothing pops up, it fills in all the things it needs to do, but once it fills in the value, it kind of stops until it hits enter at a certain point. Not sure why. 

I got it to work, through trial and error. 

This seems to work...

EndIf
    $index += 1
    If $OrderId<>$OrderNext Then
    Call("CleanUp", $iFrom, $OrderId, $OrderNext)
    EndIf
    WEnd
EndFunc ;==> Process

 

Edited by Nilkimas

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
  • Recently Browsing   0 members

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