Jump to content
Sign in to follow this  

Save data that i get from "mousegetpos"

Recommended Posts

So I want to make program that will use the coordinate that I got from “mousegetpos”.

What I want do :

1. I want use “mousegetpos” to get coordinate and save it as x1 and y1 in notepad in my desktop file name “test.txt” and will repeat again to get x2, y2 and x3, y3.

2. then I will use the text.txt to run my other autoit, the program only use “mouseclick” leftclick in coordinate that I save in "test.txt".

I am confuse how to save data to text and also how to take the data and use it in my program.

Help me please I already try search by my self but no luck

Share this post

Link to post
Share on other sites

FileWriteLine() and FileReadLine(). See help file.


still confuse can u give 1 example of simple autoit, for FileWriteLine() and FileReadLine()that work with "mousegetpos" and "moueclick" please i see the help file but still cunfuse

Share this post

Link to post
Share on other sites

All of those functions have example scripts in the help file. You try those first to get a basic understanding of the functions. Then you can try combining them into a new script. If you do that and it doesn't work, just post your script here for more help.

Writing scripts for you is just not what we do here, but don't be afraid to post broken stuff and get help with it. We all started there ourselves!


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

this is what i have in mine:

#include <File.au3>

HotKeySet("r", "lol")

while 1 = 1

Sleep ("1000")


Func lol()

$pos = MouseGetPos()

MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])


the top part get me coordinate,

$file = FileOpen("test.txt", 1)

; Check if file opened for writing OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")



FileWriteLine($file, "Line1")

FileWriteLine($file, "Line2" & @CRLF)

FileWriteLine($file, "Line3")


the second part is to write a line to notepad

how can i make the second program write the coordinate from part 1, i still new in autoit so i confuse how autoit work. Should i save the value of coordinate first as array the run the second command? should i make 2 program instead one for someting like this? well i think this will be better as 1 loop, and where can i get sample or simple autoit?

i learn VB before but the logic is a bit different with autoit, that why i looking for a lot sample of source code so i can see the way auto it work.


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...