Jump to content
Sign in to follow this  
erezlevi

#AutoIt3Wrapper_Run_Debug_Mode=Y

Recommended Posts

erezlevi

hi,

is there a way that after creating the .exe file dubugging will work and write the steps been done by the .exe to a txt file?

Share this post


Link to post
Share on other sites
TurionAltec

I didn't even know that option existed.

I found the following post about Opt("TrayIconDebug") not working on compiled EXEs:

http://www.autoitscript.com/forum/index.php?showtopic=100523&view=findpost&p=718769

Compiled scripts doesn't have any sense of "lines" so that isn't possible to know. Just run the uncompiled script to find any errors

As far as debugging, you can either compile as a CLI program, and do some consolewrites at various stages of your program's execution, or use a Filewriteline() to save that information directly to a file, or look at this:

http://www.autoitscript.com/forum/index.php?showtopic=95595&view=findpost&p=705917

Further, the macro @ScriptLineNumber will return -1 if the script is compiled.

Edited by TurionAltec

Share this post


Link to post
Share on other sites
dantay9

If you are just testing it and it won't be included in the final release, you can use this. It's pretty cool and useful. It is like console write to an edit control in another program.

Func dbg($msg)
    ;use debugview from sysinternals
    ;http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx        Download
    ;http://msdn.microsoft.com/en-us/library/ms679303(VS.85).aspx        Functions
    DllCall("kernel32.dll", "none", "OutputDebugString", "str", $msg)
EndFunc   ;==>dbg

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
bo8ster

I would be thinking of redirecting the stdout to a text file but not sure how to do that but I think I saw that asked and answered recently.

In the FAQ there is a program that ConsoleWrites every line of your code but that just suffs up your code.

I would like to know how to get "#AutoIt3Wrapper_Run_Debug_Mode=Y" working for programs that use more then one file.

Edit: Ha! The redirect post was TurionAltec's!

Edited by bo8ster

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
bo8ster

I knocked up something quick, not tested in all cases. This will capture everything from output window of Scite.

This works using two scripts, one is your normal script you want to capture the output from and the other is used to capture the output.

I have used a msgbox but you can replace that with a FileWrite.

Script One - My custom script where I want to save the output. Fancy I know! Note Comments are not written using #AutoIt3Wrapper_Run_Debug_Mode=Y

#AutoIt3Wrapper_Run_Debug_Mode=Y
AutoItSetOption("SendKeyDelay", 90);
AutoItSetOption("MustDeclareVars", 1)

ConsoleWrite(@CRLF & @CRLF & " Hello world" & @CRLF & " This is a test" & @CRLF & @CRLF)

;~ End of script
Exit

Script Two - Used to execute and capture the output of Script One. Most of it I copied from the help file. The run cmd I got from Scite when Pressing F5. I believe everything comes from STDOUT so STDERR is not really required but its there.

#include <Constants.au3>

Local $foo = Run('"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\<....>\workspace.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

Local $line
While 1
    ProcessWaitClose($foo)
    $line = StdoutRead($foo)
    If @error Then ExitLoop
    MsgBox(0, "STDOUT read:", $line)
    
Wend

While 1
    ProcessWaitClose($foo)
    $line = StderrRead($foo)
    If @error Then ExitLoop
    MsgBox(0, "STDERR read:", $line)
Wend

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

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.