Jump to content
Sign in to follow this  
Eagle117

Step through code?

Recommended Posts

Eagle117

I'm completely new to AutoIt but I wrote a script to automate opening some windows and do some file processing that I needed at work and now I'm a hero! One thing that I found annoying was that when something went wrong and it stopped doing what I expected, I couldn't find a way to see where in the script it was. Is there a way to step through the code or at least to see what line it hung on so I can debug it? I searched around in Help but didn't find anything.

Share this post


Link to post
Share on other sites
erebus

Try by adding MsgBox(es) in your code so as to know each time which part is being executed. I.e.:

; code here

MsgBox(0,"","ok this is finished")

; more code here

MsgBox(0,"","ok with this too")

; and so on...

Of course there are more elegant ways to debug your code but this is a fast and dirty example which is easy to remember.

Share this post


Link to post
Share on other sites
Eagle117

That is what I've been doing but normally I'm ripping through a list of 500-1000 entries and it takes nearly 15 minutes to complete what I need it to do. It is normally the last or second to last entry that it hangs on so I wouldn't want to answer that box every single time.

I've been playing around in the forum search and it appears that there isn't really the step feature that I'm looking for. Maybe I can use the dbg command or something.

Share this post


Link to post
Share on other sites
herewasplato

...a list of 500-1000 entries...

Add AutoItSetOption ("TrayIconDebug", 1) to the top of your script and then mouse over the AutoIt icon whenever your script hangs.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
Eagle117

Thank you. That will help a lot.

Share this post


Link to post
Share on other sites
herewasplato

Thank you. That will help a lot.

You are welcome. Enjoy AutoIt.

Edit: ...and a belated welcome to the forum...

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

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  

×