Jump to content
Sign in to follow this  
ddr4lyfe

Need help with coding something

Recommended Posts

ddr4lyfe

Hello all, I need a little help with a script I'm making. I have typed out all of the coordinates that I would need to click on, but I need to figure out how I could click another location after clicking one location. For instance:

MouseClick ("left",500,600,1,1)
MouseClick ("left",600,700,1,1)

How would I code my script so that I could tell it to move the cursor a certain distance right (X+10) and a certain distance down (Y+25) from both (500,600) and (600,700), so it would click (510,625) after clicking (500,600) then click (610,725) after clicking (600,700). I could just find the mouse coordinates at those locations, but I have a lot of locations, and it would be a pain in the butt to put all of those locations down when I could just say move right 10 and down 25 and click. I'm guessing I would have to get the mouse coordinates first, and somehow assign the x and y values to certain variables then do a mouse move to (x_variable+10, y_variable+25). Also, I need to have it click if the cursor is a hand and not click if it's just a normal cursor, but I'm guessing I could just use GetCursorType or whatever the code is and assign it to a variable and if that variable is equal to 0 (hand cursor) then click and if it isn't equal to zero (or just equal to 2) then don't click, right? Thanks in advance for any help or solutions given.

Share this post


Link to post
Share on other sites
Generator

If the coord is keep increasing in a 15 and 25 rate. you can do this

Global $x=15, $y=25
While 1
MouseClick("left","50   ][ÝÊÉÌÍÞ  ][ÝÍ  ][ÝÊÉÌÍÞKKJB[ÝÙPÛXÚÈ
    ][ÝÛY ][ÝË  V÷C³cgV÷C²²b33c·ÂgV÷C³sgV÷C²²b33c·Ãâb33c·Òb33c·³P¢b33cäôÀÌØíä¬ÈÔ)]¹(

Not tested.

Share this post


Link to post
Share on other sites
PsaltyDS

Put your coordinates in a list like:

$MouseCoords = "500,600;600,700;820,750"

That makes it easy to create/edit the list.

StringSplit on ";" to break it into an array of coordinate pairs, then For/Next loop through the array and StringSplit on "," to get each X/Y pair. Should be able to do all of them in five or six lines of code.

Take a shot at it and post your code (working or not), and you'll get plenty of help.

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
PsaltyDS

If the coord is keep increasing in a 15 and 25 rate. you can do this

If that's the functionality needed, it would be better with Do/Until vice While/WEnd, so it can stop at the bottom of the screen.

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Generator

If that's the functionality needed, it would be better with Do/Until vice While/WEnd, so it can stop at the bottom of the screen.

:rolleyes:

I just gave him the idea so he could work on it, like PsaltyDS said, it will be much better if you provide a list of coord.

Share this post


Link to post
Share on other sites
DW1

something like:

While $x < @DesktopWidth and $y < @desktopheight

;other shit here

Wend

for the while statement

Share this post


Link to post
Share on other sites
Generator

something like:

While $x < @DesktopWidth and $y < @desktopheight

;other shit here

Wend

for the while statement

Good point, i didn't notice that.

Share this post


Link to post
Share on other sites
ddr4lyfe

Put your coordinates in a list like:

$MouseCoords = "500,600;600,700;820,750"

That makes it easy to create/edit the list.

StringSplit on ";" to break it into an array of coordinate pairs, then For/Next loop through the array and StringSplit on "," to get each X/Y pair. Should be able to do all of them in five or six lines of code.

Take a shot at it and post your code (working or not), and you'll get plenty of help.

...Say what now? XD; I'm quite the beginner still at this stuff, I can mouseclick, send, all the basic stuff, I do understand what For is, and I'm guessing that in the For loop, to go to the next coordinate, that's what the Next is for, and I'm guessing that StringSplit tells it to split the string at each point you tell it to (, and :rolleyes: but I don't think that's solving my problem, however, I believe Generator answered my basic question. I didn't know that you could say

MouseClick("left","500"+$x,"600"+$y,1,1)

But thanks for the help both of you, I'll go try Generator's suggestion in a moment, I'm busy researching other things.

Share this post


Link to post
Share on other sites
PsaltyDS

A demo of what I thought you meant (only moves mouse, no clicking):

$MouseString = "100,100;130,205;300,400;320,600;450,80;650,700;50
LÎL
ÍLÎLLÌL
L   ][ÝÂÌÍÓ[ÝÙP^HHÝ[ÔÜ]
    ÌÍÓ[ÝU7G&ærÂgV÷C³²gV÷C² ¤f÷"b33c¶âÒFòb33c´Ö÷W6T'&³Ð b33c¶eôMÑÉ¥¹MÁ±¥Ð ÀÌØí5½ÕÍÉÉålÀÌØí¹t°ÅÕ½Ðì°ÅÕ½Ðì¤(%%ÀÌØíÙaelÁtô2 Then
        MouseMove($avXY[1], $avXY[2])
        Sleep(500)
        MouseMove(&ÌÍØ]VÌWH
ÈL ÌÍØ]VÌH
ÈJBBTÛY
L
BQ[Y^

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
ddr4lyfe

I....think I see what you're saying, but I'll probably do something like:

$curtype = GetCursorType
MoveMouse (x,y)
If $curtype = 0 Then
     MouseClick ("left",x,y,1,1)
     MouseClick ("left",x+10,y+25,1,1)
Else MoveMouse (next_x,next_y)
EndIf

I'm not sure if those are the correct codes or whatever, but you get the idea, right?

Share this post


Link to post
Share on other sites
Generator

I....think I see what you're saying, but I'll probably do something like:

$curtype = GetCursorType
MoveMouse (x,y)
If $curtype = 0 Then
     MouseClick ("left",x,y,1,1)
     MouseClick ("left",x+10,y+25,1,1)
Else MoveMouse (next_x,next_y)
EndIf

I'm not sure if those are the correct codes or whatever, but you get the idea, right?

I don't know what you mean by GetCursorType, but you may also want to check out GetColorUnderMouse UDF in Example Script forum. and matches color as your needs.

Share this post


Link to post
Share on other sites
ddr4lyfe

Oh, sorry, let me fix that:

$curtype = MouseGetCursor
MouseMove (x,y)
If $curtype = 0 Then
     MouseClick ("left",x,y,1,1)
     MouseClick ("left",x+10,y+25,1,1)
Else MouseMove (next_x,next_y)
EndIf

Share this post


Link to post
Share on other sites
DW1

with that code, make sure your step of x and y are big enough that you don't get multiple clicks on the same link :rolleyes:

Share this post


Link to post
Share on other sites
ddr4lyfe

Well, I've already used my Window Information program-thing to scope it out and this works, but I'll probably add some sort of sleep in there, like make the +10 +25 click take longer to click or something just to be sure that it clicks it when the menu pops up.

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  

×