Jump to content
Sign in to follow this  
Burgs

Debugging tools?

Recommended Posts

Burgs

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.

Share this post


Link to post
Share on other sites
enaiman

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 :)

Share this post


Link to post
Share on other sites
Stumpii

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.

Share this post


Link to post
Share on other sites
Burgs

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

Share this post


Link to post
Share on other sites
Jos

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
enaiman

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 :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.