Sign in to follow this  
Followers 0
EagleTG

Debug Window

6 posts in this topic

I've created the following for the scripts I write. It helps me tremendously when writing AutoIt scripts. There might be a better/easier way, not sure. Kind-of a newbie at AutoIt.

#include <GUIConstants.au3>

Dim $dbg

GuiCreate ("Debug Window",500,75,0,0,"",$WS_EX_TOPMOST)
GuiSetState (@SW_SHOW)

Func Debug($dbg)
     GuiCtrlCreateLabel ($dbg & "                                                                  ",10,10)
    ;Sleep(1000)
EndFunc

Debug ("Nothing to report")

It creates a window, top-left of the screen. Anywhere in your script, you can use Debug("Text Here") and it will update that (always on-top) window to tell you where you are within your script.

Just thought this might help someone. I'm also curious if there are any better ways that people have found of doing something similar? Basically, just to know exactly what your script is doing, etc. For example, if it's waiting for a window with a WinWaitActive and that window never shows up, if you put a Debug("Waiting for Window [window name here]"), it'll give you a checkpoint so you can see where the script got hung-up.

The commented ;Sleep(1000) is a delay so you can see each step of lines that run by too quickly.

Enjoy!

Share this post


Link to post
Share on other sites



consolewrite.

ConsoleWrite() will only work when you shell your AutoIt script from it and your editor supports reading the output produced.

Not everybody is using the SciTE4AutoIt3 setup.

@EagleTG: You might want to have a look at SciTE4AutoIt3 and the Debug Scripts it includes. B)


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

Share this post


Link to post
Share on other sites

See my version.

Many dependent functions, I know.

It's better this way.

Debug.au3

Share this post


Link to post
Share on other sites

JdeB: SciTE4AutoIt3 looks totally awesome. I'm digging into that right now. I've got it installed, and am settling in. Thanks for that tip... I've been trolling the forums for a while, how did I EVER miss this?!!

SlimShady: Thanks a million, yours looks awesome. Very nice... I never thought to use a Textbox so I could have a history... :doh!:

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  
Followers 0