Sign in to follow this  
Followers 0
Hyflex

Converting Coords into an Array?

3 posts in this topic

#1 ·  Posted (edited)

Hey,

I have a grid of: 6x10 and I am looking to try and get an easier way to move to each grid "cube"

AniMouseClick($CubeOneX + ($CubeSize * 0), $CubeOneY + ($CubeSize * 0), 0)  ; Top Right
AniMouseClick($CubeOneX + ($CubeSize * 0), $CubeOneY + ($CubeSize * 5), 0)  ; Bottom Right
AniMouseClick($CubeOneX - ($CubeSize * 9), $CubeOneY + ($CubeSize * 5), 0)  ; Bottom Left
AniMouseClick($CubeOneX - ($CubeSize * 9), $CubeOneY + ($CubeSize * 0), 0)  ; Top Left

It would be good if I could do:

AniMouseClick(10, 1, 1) ; Top Right
AniMouseClick(10, 6, 1) ; Bottom Right
AniMouseClick(1, 6, 1) ; Bottom Left
AniMouseClick(1, 1, 1) ; Top Left

Does anyone know how I can achieve this?

Edited by XxXGoD

Share this post


Link to post
Share on other sites



set up a 2d array like so

Dim aCoords[5][2] = [ [10, 10], [15, 10], [20, 10], [25, 10], [30, 10]  ] ; [x coord, y coord]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <Array.au3>

$iSize = 20

$iMidPoint = $iSize/2
$iMaxX = 6
$iMaxY = 10
Dim $aGrid[$iMaxX][$iMaxY]
$X = $iMidPoint
For $i = 0 To UBound ( $aGrid ) - 1
$Y = $iMidPoint
For $j = 0 To UBound ( $aGrid, 2 ) - 1
  $aGrid[$i][$j] = $X & "," & $Y
  $Y = $Y  + $iSize
Next
$X = $X + $iSize
Next

_ArrayDisplay ( $aGrid )

; Click 0,0:
$XYCoord = $aGrid[0][0]
$aXYCoord = StringSplit ( $XYCoord, "," )
$sXCoord = $aXYCoord[1]
$sYCoord = $aXYCoord[2]
MsgBox ( 4096, "click pos", "xcoord=" & $sXCoord & " ycoord=" & $sYCoord )

example of getting where to click for 0,0( bottom left box )...but you can sub in any coord, like 3,8: $aGrid[3][8]

replace $iSize = 20 with actual pixel size of squares

oh, and these are coords relative to the starting point of the grid (bottom left)...that's important

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0