Jump to content

Simple filewrite question


Recommended Posts

I'm taking a file, reading it's contents and pulling out the mousemove(x,y). I'm writing this into a file in mouseclick("left",x,y,1,1) format.

How can I have it write the quote marks around LEFT when it writes to the file?

#include <misc.au3>
 #include <file.au3>
HotKeySet("'","_Start")
HotKeySet("/","_End")
 
 
 While 1
    Sleep(100)
 WEnd
 
 
 Func _Start()
    $count = _FileCountLines("blah.au3")
    for $x = 0 to $count step 1
        $line = FileReadLine("blah.au3",$x)
        $string = StringLen ( $line ) 
        $left = Stringmid($line,10,1)
        $left2 = Stringmid($line,11,7)
        $left3 = Stringmid($line,18,1)
        If $string = 18 Then
            Filewriteline("coors.au3","mouseclick" & $left & "left", $left2,$left3)
            FileWriteLine("coors.au3","Sleep(1500)")
        EndIf
    Next
    msgbox(0,"Done","Done")
 EndFunc
 
 Func _End()
    Exit
 EndFunc
Link to comment
Share on other sites

You will also find that using _FileReadToArray() is much faster than just using FileReadLine().

Put It in a For/Next loop and use an If NOT StringInStr($array[$I], 'Text You want') Then ContinueLoop

And if the quotation marks are in the line you're reading then StringMid($line, 10, 8) might work. If that misses the closing quote then make it 10, 9

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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