Jump to content
Sign in to follow this  
Leopardfist

Filewrite error

Recommended Posts

Leopardfist

Func write()
    $pos = MouseGetPos()
    $file = FileOpen("C:\Users\Admin\Desktop\coordinates.txt", 1)
    
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf

    FileWrite($file, $pos(0) & ", " & $pos(1))
    FileClose($file)
EndFunc

this is the error I get

C:\Users\Admin\Desktop\coord.au3 (19) : ==> Error in expression.:

FileWrite($file, $pos(0))

FileWrite($file, ^ ERROR

->12:47:38 AutoIT3.exe ended.rc:1

Can anyone tell me how I can write with a variable or array? If not how would you suggest I perform this function... but keep in mind this is a function called from a hotkey, which I am using several times.... which is why I was attempting to write to a file rather than use a msgbox. Also the game is full screen mode so I cant use windowinfo.

Thanks for the help!

Share this post


Link to post
Share on other sites
somdcomputerguy

Use square brackets in arrays

FileWrite($file, $pos[0] & ", " & $pos[1])

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Leopardfist

AHH!! Thanks man, been awhile since I used Autoit hehe.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.