Jump to content
Sign in to follow this  
pekster

Debugger

Recommended Posts

hey pekster, cool deal, just ran it on my screenshot script... didn't see what errors look like, but I've now got a desktop shortcut to drop onto...


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

@pekster, I know this is an old thread, but is there any way you could modify your script to allow it to write the current line executed as well as the line number to the log? It would make your script more like TrayIconDebug. I am looking for something that simply echos the current line to the log.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

What about adding a line to store the @Error value before writing the log record? Then the program uses the stored value instead of @Error. Your program/script that does the inserts would have to find @Error lines and replace them with the variable. So a couple of lines like these

$x = FileReadLine($fn1)
If @Error Then

would become

$x = FileReadLine($fn1) ;Original Line
$error = @Error
FileWriteLine($logfile, "$x = FileReadLine($fn1)")
If $Error Then
$error = @Error
FileWriteLine($logfile, "If @Error Then")

NB: I haven't actually looked at your code, but this is the kind of thing that makes sense. You would have to make sure that the variable your script uses for the temporary $Error is not uses in the original script, along with the $logfile variable.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

@pekster, I know this is an old thread, but is there any way you could modify your script to allow it to write the current line executed as well as the line number to the log? It would make your script more like TrayIconDebug. I am looking for something that simply echos the current line to the log.

<{POST_SNAPBACK}>

I don't get what you mean... it currently does write a line to the log after every line executed, except in places where it would destroy the code. It is possable to remove the restriction for @error usage, but it would still have to skip lines that use the _ char (or join them, but that would mess up the original script's line numbers, and thus the debug log would become useless.)

Couldn't temporarily storing @error, inserting the debugging code, then calling SetError() work as well?

<{POST_SNAPBACK}>

Nice idea :ph34r: . I'll plan on releasing a new version when I have a bit of time to make the change.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

I mean that I need a copy of the actual text executed to be written to the log as well as the line number.


Who else would I be?

Share this post


Link to post
Share on other sites

I mean that I need a copy of the actual text executed to be written to the log as well as the line number.

<{POST_SNAPBACK}>

I should be able to manage that as an option with an extra checkbox in the GUI.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Couldn't temporarily storing @error, inserting the debugging code, then calling SetError() work as well?

<{POST_SNAPBACK}>

That is an even better way to do it and you do not have to parse the line. Sort of like:

$x=FileReadLine($fn) ;Original Line
$_Error = @Error
FileWriteLine($fn, "27:  $x=FileReadLine($fn)")
SetError($_Error)

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

That is an even better way to do it and you do not have to parse the line.

<{POST_SNAPBACK}>

I still need to look through all lines for occurances of the underscore character to join lines and skip accordingly. Plus it's a lot less lines of code to do the @error save and restore in the Debugger function instead of every line where one might occur.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

No, I've had a few things going on, including settling into my new job with strange hours.

I've also ran into a few issues I had to work around, especially with the log echo. You can't treat it as a string due to potential complex usages that may occur. I can't simply devise a replacement algorithm because of lines like this:

Command('text " more text', "text ' more text")

I've found a solution to this problem, just haven't had time to throw it together yet. I'm aiming for sometime Friday to have it tested and working with the new features. I'll probably call it 1.9. Versions 2.x should include the ability to log specific lines or not log specific lines (including ranges!)

Minor edit

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

I still need to look through all lines for occurances of the underscore character to join lines and skip accordingly.  Plus it's a lot less lines of code to do the @error save and restore in the Debugger function instead of every line where one might occur.

<{POST_SNAPBACK}>

As a local function variable! :ph34r: Of course. No need to check for a pre-existing variable.

$x = FileReadLine($fn)
DebugFunc("$x = FileReadLine($fn)", @Error);Debug function call


Func DebugFunc($line, $Error)
    FileWriteLine($LogFile, $Line)
    SetError($Error)
EndFunc

Well, when the source for V3.0.103 is posted, then I will start working on the integrated debug version. I expect to use the features that I mentioned earlier in the developer forum.

Edited by Nutster

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

Nice idea Nuster, but it still results in a lot larger filesize than my function does. I just have to store @error to a local variable within the Debug function, which takes up a fixed bytesize. If I were to add @error as a paramater to the Debug paramaters, it would add the size that ", @error" takes up with every Debug call.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

That's not too hard. Try this:

Original Code:

msgbox(0,"","This is a 'string' inside of a 'string' with quotes")

If you echo using " as surrounding quotes, then replace all " with "", if you use ' as surrounding, use replace ' with '' in the result:

Echo code:

echo("msgbox(0,"""",""This is a 'string' inside of a 'string' with quotes"")")

Notice " is replaced with "" in second code, and it works perfectly.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

No, I can't do that. You conviently ignore the possability that someone may use both single quotes within a double quoted string, and double quotes within a single quoted string.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Fair enough. :( I was just shooting my mouth (fingers?) off. :ph34r:


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

msgbox(0,"","msgbox(0,"""",""This is a 'string' inside of a 'string' with quotes"" & @LF & 'This is another ""string"" inside a ""string"" with quotes')")
seems to work fine for me... could you give me an example?

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

Heh, yea, you're right. Sorry, I'm swamped with some work stuff for my 2nd job and didn't read your post all the way through. Yea, that'll work :(. Now I just gotta impliment it, as well as the timestamp option I'm building.

Also, I'm working against an underscore issue that I've posted to the support forum. I'm not going to wait on an answer if I'm ready to release my version, but it would be nice to have solved. If you haven't taken a look, give it a go.

Edit: And just so you know, that wasn't directed only at this-is-me. 'You' is inclusive. I didn't want to sound like I was demanding that this-is-me fix my problems :ph34r:.

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Version 1.9 released. New features include (see version history for more details):

  • @error protection lifted
  • 2 new options for timestamps and code echo
Changes planned for 2.0 include a "before line" or "after line" debug (current 1.9 version only does "after line") and an advanced option to select individual lines (or ranges of lines) to include/ exclude.

As usual, command line options are provided, and you may drag any au3 file to the exe (or a shortcut) to create the debug script.

Download via the web interface in my signature.

Grammer edit

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...