Jump to content

multiplying variable every loop


Recommended Posts

I want to make a scrip that does a simple action in excel, by clicking on each unit, doing a simple action and then moving to the higher/lower unit, I came up with that idea, but don't know how to multiply variable $moveY x+1 time every time loop runs

$OriginalX = MouseGetPos(0)
    $OriginalY = MouseGetPos(1)
    $MoveX = 0
    $MoveY = -73
Dim $i=1
While $i<=10
  ;Action
   MouseMove(403,964) ;starting unit coords
    MouseMove($OriginalX + $MoveX, $OriginalY + $MoveY)
   WEnd

 

Link to comment
Share on other sites

For $i = 1 To 10
    ;Action
    MouseMove(403,964) ;starting unit coords
    MouseMove($OriginalX + $MoveX*$i, $OriginalY + $MoveY*$i)
Next

 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

9 minutes ago, beekeeper222 said:

But i'd have to write the script all over again, that one is almost completed

I agree with @Subz !
Your script may seem almost completed to you, but you are using a rather unreliable approach. It should not take too much effort to rebuild the script using the Excel UDF. On the long run, you will probably even save time if, for example, extensions are required.

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

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