Jump to content
Sign in to follow this  

random "Illegal text at the end of statement"

Recommended Posts

I have a script with a logging function that simply outputs to the console in Scite with a date/time stamp:

func logoutput($msg)
    $systime = _Date_Time_GetSystemTime()
    $systime = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($systime))
    $darray = _Date_Time_SystemTimeToArray($systime)
    $datetime = StringFormat("%04d/%02d/%02d %02d:%02d:%02d.%03d", $darray[2], $darray[0], $darray[1], $darray[3], $darray[4], $darray[5], $darray[6])

    $msg = $datetime & ' ' & $msg

The script will run and call this function many, many times and output to the console fine. But after running for about 45 minutes it will crash with the following error:

"C:\Users\XXXXXXX\Desktop\autoit\test.au3" (538) : ==> Illegal text at the end of statement (one statement per line).:
func logoutput($msg)
func logoutput($msg)^ ERROR

This makes no sense because how could it call the function so many times successfully and then all of a sudden have a syntax error with the same code?!

I figure this must be a bogus error or some sort of bug or maybe the console is filling up too much?

I checked and I am filling the console with around 6200 lines and about 344kb of text. I swear that I have made scripts that output more though...

I made a test script that just outputs lines to the console by calling my logoutput() and it got to over 7000 lines without crashing so somehow the error must have something to do with the rest of my script...

Does anyone have any idea what could be going on here?

This is autoit v3.3.10.2 if it matters.

Share this post

Link to post
Share on other sites

Welp,fixed it myself.

Turns out that there was a really stupid typo on one of the lines that was calling this function and was not called very often and that was the problem. The error was not pointing me in the right direction.

Hopefully someone else someday will have a similar problem and this will help them...

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  

  • Create New...