Jump to content

How do I find X and Y?


Draegon
 Share

Recommended Posts

I am trying to do MouseClick but I don't know how to find my X and Y, I am using a 1024 768 if anyone needs to know.

Please help!

I dont know why no one answer to you :\

This is easy

Start / Programs / AutoIT v3 / AutoIt Window Info

Then you can see small window with all informations what you need. Example

>>>> Window <<<<
Title:  Replying To How do I find X and Y? - AutoIt Forums - Mozilla Firefox
Class:  MozillaUIWindowClass
Position:   -8, -8
Size:   1382, 754
Style:  0x15CF0000
ExStyle:    0x00000100
Handle: 0x000501A6

>>>> Control <<<<
Class:  MozillaWindowClass
Instance:   5
ClassnameNN:    MozillaWindowClass5
Advanced (Class):   [CLASS:MozillaWindowClass; INSTANCE:5]
ID: 
Text:   
Position:   0, 134
Size:   1349, 562
ControlClick Coords:    589, 408
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x00100EEA

>>>> Mouse <<<<
Position:   589, 542
Cursor ID:  5
Color:  0xFFFFFF

>>>> StatusBar <<<<

>>>> Visible Text <<<<


>>>> Hidden Text <<<<

In "Summary" Bookmark (there you can see all informations about X window and Mouse Position).

Remembaer about "Options / CoordMode".

and set in your code

====================

Opt"MouseCoordMode, X(read under this line)"

Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

Anything else?

This world is crazy

Link to comment
Share on other sites

Oh and also how do I repeat a script like this:

mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )

sleep ( 1000 )

mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )

sleep ( 100 )

mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )

sleep ( 100 )

mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )

sleep ( 30000 )

send ( "F5" [, 0 ] )

Also is there something incorrect with it? Besides the fact I don't have my x and y.

Link to comment
Share on other sites

Another options is the Window Info Tool (AU3Info.exe) included with AutoIt. It can give you mouse coordinates in the relative mode (i.e. Screen or Window) needed for what you're doing.

:)

Edit:

Oh and also how do I repeat a script like this:

mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )

sleep ( 1000 )

mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )

sleep ( 100 )

mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )

sleep ( 100 )

mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )

sleep ( 30000 )

send ( "F5" [, 0 ] )

Also is there something incorrect with it? Besides the fact I don't have my x and y.

Look at the example scripts in the help file for the functions you want to use. The square brackets are only used to indicate optional parameters and should not be in your syntax.

:)

Edited by PsaltyDS
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
Link to comment
Share on other sites

You can use While Loop

Example

While 1
mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )
sleep ( 1000 )
WEnd

This loop repeat mouseclick in every 1 second (you must know this loop is infinity

if you want use X times, i think the best way will be For Loop

Next example:

For $s=1 To 6 Step 1
mouseclick ( "left" [, x, y [, 1 [, 100 ]]] )
sleep ( 1000 )
Next

This repeat mouseclick 6 times (To 6) from 1 (For $s=1) and always use +1 (Step 1)

At the end of loop you must set

"Next"

This world is crazy

Link to comment
Share on other sites

Those square brackets shouldn't be there.

While 1
    MouseClick("left", $x, $y , 1 , 100)
    Sleep(1000)
    MouseClick("left", $x, $y , 1 , 100)
    Sleep(100)
    MouseClick("left", $x, $y , 1 , 100)
    Sleep(100)
    MouseClick("left", $x, $y , 1 , 100)
    Sleep(30000)
    Send("F5")
WEnd

However, this looks to be made for something that has a refresh, like a webpage or some other application. In that case, you need to make your script wait until the refreshing is finished before you start clicking away.

Edited by omikron48
Link to comment
Share on other sites

While 1
MouseClick("left", $x, $y , 1 , 100)
Sleep(1000)     
MouseClick("left", $x, $y , 1 , 100)    
Sleep(100)     
MouseClick("left", $x, $y , 1 , 100)     
Sleep(100)     
MouseClick("left", $x, $y , 1 , 100)     
Sleep(30000)     
Send("F5")
WEnd

Maybe this should br better ;d

$time = 100; I think this is too small delay but who know, i always set ~~300 because my computer like jokes

While 1
MouseClick("left", $x, $y , 1 , 100)
Sleep($time)     
MouseClick("left", $x, $y , 1 , 100)    
Sleep($time)     
MouseClick("left", $x, $y , 1 , 100)     
Sleep($time)     
MouseClick("left", $x, $y , 1 , 100)     
Sleep(30000)     
Send("F5")
WEnd

This world is crazy

Link to comment
Share on other sites

Just set a hotkey that exits the program.

HotKeySet($key, "_Exit")
While 1
    MouseClick("left", $x, $y , 1 , 100)
    Sleep(1000)
    MouseClick("left", $x, $y , 1 , 100)
    Sleep(100
    MouseClick("left", $x, $y , 1 , 100)
    Sleep(100)
    MouseClick("left", $x, $y , 1 , 100)
    Sleep(30000)
    Send("F5")
WEnd

Func _Exit()
    Exit
EndFunc

Also, if you see the AutoIt icon in your tray bar (unless you disabled it) you can just right click it when you have control of you mouse.

Link to comment
Share on other sites

I got it going great, now all I need to know is how to stop the program. It runs forever so I've been having to log of windows and back on again when ever I change it. Can someone help me finish this script? :)

HotKeySet("{F1}", "_exit"); Set the "_exit()" function for "F1" key. Just simple hotkey

Func _exit() ; Name of function
Exit ; What to do, here is Exit xd
EndFunc ; End

;rest of your code

Simply? i think it is.

Edit:

@Omikron48

I know you know this, but you dont set key for "$key" :)

Edited by Sobiech

This world is crazy

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