Jump to content

FileWrite creating issues


Recommended Posts

i tried looking at search and googled it too but nothing helped me so

my program is supposed to detect an image on a page and according to the image detected it is suppoed to write something to the file and this is in an infinite loop which is broken when the hotkey is being called

the program works perfectly for a while like iwaited for it to write 8-10 times and then i called the hotkey

but when i try to leave the program to run for a longer time say like an hour or two the file becomes weird(not the right team to use but hope you get it)

my older save to the file is also changed to something like

⁂⁂⁒⁂⁒⁂⁂⁒⁂⁒⁒⁒⁂⁂⁒⁂⁒⁂⁂⁒⁂⁂⁂⁒⁂⁂⁒⁒⁇⁂⁂⁂⁒⁒⁂⁂⁂⁒⁂⁒⁂⁒⁂⁂⁒⁂⁒⁒⁂⁂⁂⁂⁒⁇⁂⁂⁂⁒⁒⁒⁒⁒

while i expect the output to be like

R B G B B R R G B B B B R R B (and so on)

 

$filewins = FileOpen($fileloc, $FO_OVERWRITE)
Global $stopper = 0
$starttime = TimerInit()
while $stopper = 0
    $resultroll = _ImageSearch($imgroll, 1, $x1, $y1, 0, 0)
    If $resultroll = 1 Then
        While $resultroll = 1
            $resultroll = _ImageSearch($imgroll, 1, $x1, $y1, 0, 0)
        WEnd
        Sleep(500)
        $isblack = _ImageSearch($imgblack, 1, $x1, $y1, 0, 0)
        $isred = _ImageSearch($imgred, 1, $x1, $y1, 0, 0)
        $isgreen = _ImageSearch($imggreen, 1, $x1, $y1, 0, 0)
        If $isblack = 1 Then
            $isblack = 0
            FileWrite($filewins, "B ")
            ConsoleWrite("B " & @LF)
        ElseIf $isred = 1 Then
            $isred = 0
            FileWrite($filewins, "R ")
            ConsoleWrite("R " & @LF)
        ElseIf $isgreen = 1 Then
            $isgreen = 0
            FileWrite($filewins, "G ")
            ConsoleWrite("G " & @LF)
        EndIf
    EndIf
WEnd

i have no clue how to fix this or what is cauing it

Edited by Jos
Link to comment
Share on other sites

I've had issues like that, not with filewrite, but anyway what im trying to say is, that seems like encoding issues to me.

What happens if in the text editor you use, you convert the text to another type of encoding?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Just now, Jos said:

The script isn't complete as it seems.

Jos

sorry but i did not understand as i have closed the file

here is the rest of the code(i thought this might not be required)

$timeTaken = TimerDiff($starttime)/1000
;~ MsgBox(0, "time", $timeTaken & " seconds")
FileWrite($filewins, "--------" & "time: " & $timeTaken)
FileClose($filewins)

Func terminate()
    $stopper = 1
EndFunc
 

Link to comment
Share on other sites

  • Developers

Pretty sure it still isn't complete as I don't see any hotkeyset() and nowhere see $filewins  set.  Do yourseldf and us a favor and simply post the script that is runable as else we are guessing.
Are you viewing the file will still being open or do you wait till the script ended and the file is closed?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

5 minutes ago, Jos said:

Pretty sure it still isn't complete as I don't see any hotkeyset() and nowhere see $filewins  set.  Do yourseldf and us a favor and simply post the script that is runable as else we are guessing.
Are you viewing the file will still being open or do you wait till the script ended and the file is closed?

Jos

i just attached my file to this so you can see the complete file

wtfskins.au3

Link to comment
Share on other sites

  • Moderators

@akshatgupta you seem to have strolled right past the forum rules on your way in. I suggest you read them now, particularly the bit on game automation, and you will see why this thread is locked. wtfskins, dragonlore, etc. are all included in this. You will receive no assistance on this subject.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...