beekeeper222 Posted May 30, 2020 Share Posted May 30, 2020 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 More sharing options...
Subz Posted May 30, 2020 Share Posted May 30, 2020 Why not use the Excel UDF included with Autoit? Link to comment Share on other sites More sharing options...
beekeeper222 Posted May 30, 2020 Author Share Posted May 30, 2020 What is that? Link to comment Share on other sites More sharing options...
Subz Posted May 30, 2020 Share Posted May 30, 2020 If you look at the AutoIt help file, you'll see the _Excel_... functions, along with examples. Link to comment Share on other sites More sharing options...
beekeeper222 Posted May 30, 2020 Author Share Posted May 30, 2020 But i'd have to write the script all over again, that one is almost completed, I only need to apply the multiplyier, don't tou know how to do that? Link to comment Share on other sites More sharing options...
jdelaney Posted May 30, 2020 Share Posted May 30, 2020 (edited) For $i = 1 To 10 ;Action MouseMove(403,964) ;starting unit coords MouseMove($OriginalX + $MoveX*$i, $OriginalY + $MoveY*$i) Next Edited May 30, 2020 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 More sharing options...
Subz Posted May 30, 2020 Share Posted May 30, 2020 Sure, you just change $MoveY each time you click, but wouldn't recommend this method for Excel, in fact I rarely recommend mouseclick or send for anything. Link to comment Share on other sites More sharing options...
beekeeper222 Posted May 30, 2020 Author Share Posted May 30, 2020 jdelaney that is exactly what I wanted, thak you guys so much for help Link to comment Share on other sites More sharing options...
Musashi Posted May 30, 2020 Share Posted May 30, 2020 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. "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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now