Jump to content

How to minus number from varible count?


 Share

Recommended Posts

Hello,

With the code below I'm tring to subtract one number from a varible $i when the button $btn_Previous if clicked. I added this code

If $msg2 = $btn_Previous Then 
        $i = $i - 1 
       EndIf
but it did not work. How can I subtract one number from the varible $i?

For $i = $nrowM To $lrowM;Loop        
     $sCellValue2 = _ExcelReadCell($oExcel1, $i, 2);serialno 
     $sCellValue3 = _ExcelReadCell($oExcel1, $i, 3);ffinvpart & Equipment
     $sCellValue4 = _ExcelReadCell($oExcel1, $i, 4);description 
     $sCellValue6 = _ExcelReadCell($oExcel1, $i, 6);roomno
     $sCellValue7 = _ExcelReadCell($oExcel1, $i, 7);extradesc or notes
     Do
     $msg2 = GUIGetMsg()
     Select
      Case $msg2 = $btn_Next or $msg2 = $btn_Previous     
      
     ;Call Function to Activate/maximize FF Inventory Management - \\Remote window
       winFFInv()
        
      ; Click in FF Equipment Field  
        MouseClick("left", 114, 135)
      ; Now that the Notepad window is active type some special characters 
        Send($sCellValue3 & "{ENTER}");invpart & Equipment      
        Sleep(2000)
        Send($sCellValue1 & "-" & $sCellValue2 & "{ENTER 2}");serialno      
        Sleep(2000)
        Send($sCellValue4 & "{ENTER 2}");description
        Sleep(2000)
        Send("U" & "{ENTER 7}");status
        Sleep(2000)
        Send("16" & "{ENTER 4}");shop
        Sleep(2000)
        Send($sCellValue1 & "{ENTER}");bldgno
        Sleep(2000)
        Send($sCellValue6);loc
        
        If $sCellValue7 > "" Then
        Sleep(2000)
      ; Click the Extra Description Box 
        MouseClick("left", 516, 210)
      ;Extra Description Box Text
        Send($sCellValue7)
        Sleep(2000)
        Send("!C{ENTER}")   
        Endif 
      
       If $msg2 = $btn_Previous Then 
        $i = $i - 1 
       EndIf        
      
      EndSelect   
     Until $msg2 = $btn_Next or $msg2 = $btn_Previous          
     Next

Thank you for your help,

jfcby

Edited by jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

The code you posted does not survive a syntax check in either the latest AutoIt beta or the latest release, but your way of subtracting 1 looks correct so this isn't the problem with your script.

This also works to subtact 1 from $i ...

$i -= 1

If you are using SciTe, hit Ctrl-Alt-F5 to do a syntax check on your code, and look in the lowest pane there in SciTe, to find all the problems with your script.

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

My guess is that your script isn't detecting th mouse click. Check your variables and make sur you got everything right.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

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...