Jump to content

Debugging tools?


Recommended Posts

Hi,

How are "debugging" tools used in AutoIt? I have a "FileWrite" command in my script that is not writing to the file...I'd like to be able to see the return values (1 or 0), as well as the values stored in the variables I'm trying to write to the file...I don't see any obvious way of seeing this information? Thanks in advance.

Link to comment
Share on other sites

Couple of questions:

- have you opened your file in write mode? (option 2)

- have you closed the file before checking if something was written in?

- are you sure the filename and the path is correct?

About seeing the values: you can add anytime a couple messageboxes to display variables.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Hi,

How are "debugging" tools used in AutoIt? I have a "FileWrite" command in my script that is not writing to the file...I'd like to be able to see the return values (1 or 0), as well as the values stored in the variables I'm trying to write to the file...I don't see any obvious way of seeing this information? Thanks in advance.

Take a look at the debugger link in my signature.

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Link to comment
Share on other sites

Thanks for the replies. I've got the following:

;write to the "source" file (append)

$source = FileOpen("C:\My Documents\1517.txt", 9)

;Check if file opened for reading OK

If $source = -1 Then

MsgBox(0, "Error", "Unable to open 1517 file.")

Exit

EndIf

FileWrite($source, $AsDIFF & " " & $AgDIFF & " ")

MsgBox(0, "$source:", $source)

FileClose($source)

The statements do not return a "-1", however the MsgBox for "$source" is returning a numeric value (2)...shouldn't that return the path name for the file? I don't understand why that could be the case, and of course nothing writes to the file...

Link to comment
Share on other sites

  • Developers

FileOpen() returns a FileHandle which can be used by FileRead/FileWrite/FileCLose statements. That is why you see a numeric value.

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

Add the following line to your script and see what it returns:

MsgBox(0, "Content to write", $AsDIFF & " " & $AgDIFF & " ")

if this doesn't return anything then - you send only 2 whitespaces to that file.

$source = FileOpen("C:\My Documents\1517.txt", 9) 
If $source = -1 Then
    MsgBox(0, "Error", "Unable to open 1517 file.")
    Exit
EndIf 
FileWrite($source, $AsDIFF & " " & $AgDIFF & " ") 
MsgBox(0, "Content to write", $AsDIFF & " " & $AgDIFF & " ")
FileClose($source)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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