belami07

Watch script running

14 posts in this topic

Hey,

hope u guys can help me. i am looking for a tool/possibility/etc to watch what my script is doing at the moment. For example i run a script and i know now its doing line 3 now 4 now 6 now again 3. sorry for my english hope you understand what my problem is.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

belami07,

There is an AutoIt3Wrapper directive to turn on debugging line by line (which you can limit to only certain sections of the script) or there is a graphical debugger UDF somewhere in the Examples section. I do not use either so I cannot comment on their relative utility.

M23

P.S. Welcome to the AutoIt forums.

 

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks

but i think this isnt solving my problem. I dont have any syntax errors or other errors in my script. it is just that my script is running but it does not do exactly what i want. so iwanna know what the script is doing at the moment where nothing happens.

Share this post


Link to post
Share on other sites

belami07,

Then I suggest you add the following Opt at the top of your script:

Opt("TrayIconDebug", 1)

Now the running line number is displayed as a tooltip from the tray icon when you move the mouse over it. So if the script is hanging (which is what I understand by "iwanna know what the script is doing at the moment where nothing happens") you can see where it has reached

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yeah thanks this is exactly what i wanted xD. hope i can fix my problem my problem now.

Share this post


Link to post
Share on other sites

ok thought this would solve my problem but it isnt -.-

is it possible to save the whole history of what the script did since i started it. Because i have similar Functions and they all use one function and now i know it stops in the one all use but i dont know which of the otherones used it.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

belami07,

As I mentioned in the OP, there is an AutoIt3Wrapper Debug directive which will write the entire script line by line to the console - but that might be a bit of an overkill. Why not add some debugging code (a MsgBox or ConsoleWrite) just before each call to this misfiring function? That way you could tell exactly which call causes the problem and work from there.

M23

Edited by Melba23
Typo

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks alot.

I just put ConsoleWrite("func1-...) infront of every function. So i knew at what point it was hanging. but it was still alot of text :D(10func per sec).

Share this post


Link to post
Share on other sites

belami07,

Delighted I could help.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

You still can copy and paste the consol messages into notepad and read or search. If it is too many rows, then it can be realy messy i know. What i do if i am in same shoes then you are, i just rem all the unnessesery actions and insert a tooltip or msgbox to print out what is hapening right now. Example: Msgbox(0, $function_name, "succes file found redy to open etc...")

If you have any idea where can be the problem, you can insert that stuff there and call only that function. For me up till now, it helped me always to identify if my logic was wrong and somehow my script stuck with strange reason, or my calculation was wrong and the program got different value then it should. If this doesent work for me, then i run the whole code part by part to what it does and where it is stucked. Usualy the prob is just logical problem what i made.

I hope it help at least a bit.

 

Tricky


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites

Another way to error check, instead of using a MsgBox, which becomes an active window, etc, is to write values to a log file, using _FileWriteLog or the INI functions (IniWrite, etc). That makes it easier to do comparisons, and with the Log method you get timestamps.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox

userbar.png

Share this post


Link to post
Share on other sites

Another way to error check, instead of using a MsgBox, which becomes an active window, etc, is to write values to a log file, using _FileWriteLog or the INI functions (IniWrite, etc). That makes it easier to do comparisons, and with the Log method you get timestamps.

My prob with log file, it is too long and u get the info after everything done. With Msgbox u get it in real time, and if your script calling 10 function / sec u can not be enough fast. Msgbox is stoping your script till u click on OK button, then it repeating.

Log file is equal with consol write.


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

No it's not the same, as you can tailor it to just what you want, like a MsgBox, but unlike a MsgBox, it doesn't take focus away from another window that might need to be active. You can use it more cleverly, if you have the code also wait for specific key press, so you can have a form of almost real time.

Really, you should be trying to narrow down where the problem is, and then focus on that section of code only.

Each method has its pros and cons.

It's all in how you utilize them ... best use their abilities.

If as you say, you are getting lots of returns, then that is an awful lot of MsgBox clicks, and even a MsgBox is after the fact. You should be limiting your returns.

During the crafting of my reply, a germ of an idea formed, which I have been cogitating over ever since, which is a proof of concept simple debugger, based on a logfile, adjustable GUI with a List and setup window, plus a function with various types of calls, and the use of _IsPressed, where you have a _ReadFileToArray occurring every second or so (adjustable on setup window), and populating the list in seemingly real-time ... with a slight lag of course. You could in effect, simulate F8 as used by VB. The function would get passed 3 parameters, one of which is the value to write to the log file, another is whether to activate _IsPressed in a loop (pausing your script in effect). The third would be empty, except at start and end of monitoring, where for start you would get a paused script and the setup window appearing, where you make any adjustments you require (GUI size and window position, array read timing, etc), then telling it to stop reading the array when after that section of the script. So you call the debugger with something like Debug("start/end", $val, $key). The GUI is a stand-alone executable.

It is just a simple concept at this point, and I have other things that need doing today and probably tomorrow, but I am intrigued now to how well it might work, especially if tweaked by others with greater skill than mine.

P.S. Anyway, my help is not necessarily to provide a complete solution, but get the OP to think outside the box. I just use a MsgBox myself when troubleshooting, probably 95% of the time, the console about 4%.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox

userbar.png

Share this post


Link to post
Share on other sites

I prefared tooltip or msgbox, since i always know wich function is not accured, cause when i am done with 1 function, i start testing itself to make it work 100% before i start new one. I give the right and also give wrong values what it can pull out from the methode, to test both side, what my code does with correct and uncorrect values / data. Was thinking on log, but not about checking where did i made bug in codeing part. For me log is more useful, if i give away the finished program to someone, and if bugs accured, it saveing in log file.

 

Anyway, you are right, about log file can be more useful in one hand, when you have long function, what will require a lots of msgbox clicking.


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

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