Jump to content

Stripping file


Recommended Posts

I'm trying to strip out some values from a file, but the script just seems to pause and not complete. I check for an end of file and exit if there is. But it doesnt seem to...it just pauses.

$inputfile="C:\WINNT\Profiles\user\Desktop\Personal\VirtualKeyCodes.au3"
$outputfile="C:\WINNT\Profiles\user\Desktop\mykegLOGGGG.txt"

$input=fileopen($inputfile,0)
$output=fileopen($outputfile,2)

while 1
    $charread=fileread($input,1)
    if @error=-1 then Exitloop
    if $charread="'" Then
        filewrite($output,$charread)
        if @error=-1 then Exitloop
        $charread=fileread($input,1)
        While $charread <> "'"
            filewrite($output,$charread)
            $charread=fileread($input,1)
            if @error=-1 then Exitloop
        WEnd
        filewrite($output,$charread&",")    
    EndIf
    sleep(100)
WEnd
FileClose($input)
FileClose($output)

VirtualKeyCodes.au3

Edited by closeupman
Link to comment
Share on other sites

I'm trying to strip out some values from a file, but the script just seems to pause and not complete. I check for an end of file and exit if there is. But it doesnt seem to...it just pauses.

...
        filewrite($output,$charread)
        if @error=-1 then Exitloop
        $charread=fileread($input,1)
        While $charread <> "'"
        ...

<{POST_SNAPBACK}>

My guess is you are missing an @error check after one of the FileRead statements. Perhaps the @error line above it should be below it.

Phillip

Link to comment
Share on other sites

My guess is you are missing an @error check after one of the FileRead statements.  Perhaps the @error line above it should be below it.

<{POST_SNAPBACK}>

Thanks, but actually it does work!....but took Time: 963.593 seconds!!! (that's why I thought it didnt!)

If you see the file above that I strip it isn't that big so I didn't think it would take THAT long. Is there a way to speed up the process?

Can someone optimize my script?

Thanks

:lmao:

Edited by closeupman
Link to comment
Share on other sites

Thanks, but actually it does work!....but took Time: 963.593 seconds!!! (that's why I thought it didnt!)

If you see the file above that I strip it isn't that big so I didn't think it would take THAT long. Is there a way to speed up the process?

Can someone optimize my script?

Thanks

:lmao:

<{POST_SNAPBACK}>

Oh, remove the sleep(100)! I tested on your file and it only took a couple of seconds after removing the sleep.

Phillip

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