Sign in to follow this  
Followers 0
NiTroGen

Is there any way to show the line number of the currently excuting script

11 posts in this topic

For example,

consolewrite("Running at line " & $currentLineNumber & " now..." &@CRLF);assume this line is at line 11

will give an output

Running at line 11 now...

Also is there any way to show the name of function it is excuting?

eg

Func XXX()
     consolewrite("Running " & $functionName & "...")
    ;Many codes....
     consolewrite("done!")
EndFunc

will give an output

Running XXX()...done!"

Thank you!

Share this post


Link to post
Share on other sites



Cool! Thanks!

Share this post


Link to post
Share on other sites

Opt('TrayIconDebug',1)

This is a question I've thought many times and I'm glad someone finally asked and answered it! Maybe I'm not using Opt('TrayIconDebug', 1) in the way it was designed, but when I added Opt('TrayIconDebug', 1) to a few of my scripts I was a bit disappointed.

1 - I had to mouseover the au3 tray icon in order to read the informtion. This seems a bit useless and would be better if it was displayed like a ToolTip. Yes I understand ToolTip is for Win2k or better so WinME and older can't benefit from a ToolTip. Is there a way to write this info to a ToolTip or the console using ConsoleWrite?

2 - Could be just me, but as long as you are moused over the tray icon to read the text, you have to mouse off then back over to see the information update which line the script is running. Again what would be would be better is if the information didn't require the mouseover and refreshed automatically. Yes I understand depending on how fast your computer executes the code this could be nothing more than a blur of text.

Is there a way (within SciTE or through au3 code) to step through a a script in a similar fashion that Visual Basic Editor allows Step In, Step Over, Step Out under the Debug Menu? Granted the SciTE for Au3 has a ton of stuff that regular SciTE doesn't offer. My problem being a non-programmer type/noob is that I don't know what much of the "stuff" is used for. Not to mention the help file for SciTE is virtual no existant. I know Tools > Debug to Console is available, but anytime I've used this it screws up my code with syntax errors so I didn't bother since there's not a help file.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Is there a way (within SciTE or through au3 code) to step through a a script in a similar fashion that Visual Basic Editor allows Step In, Step Over, Step Out under the Debug Menu? Granted the SciTE for Au3 has a ton of stuff that regular SciTE doesn't offer. My problem being a non-programmer type/noob is that I don't know what much of the "stuff" is used for. Not to mention the help file for SciTE is virtual no existant. I know Tools > Debug to Console is available, but anytime I've used this it screws up my code with syntax errors so I didn't bother since there's not a help file.

@ScriptLineNumber

specifically:

ToolTip(@ScriptLineNumber)
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

@ScriptLineNumber

specifically:

ToolTip(@ScriptLineNumber)oÝ÷ Ûú®¢×©ä°nx:Úr·ÝW«ÉÊ(Ën}ú'yƧ櫫x­¶¬²Ø¥¬¶©®åzj¢yrv+)¬¢azÇ+ew­äè¢Tâ¥Êz+(z0q©â¶ê綬²­Çr©¢q©ÝºZµë-ç.®·§µ·¢±yË­y×n®)ඬr¸©µ8b²+0«H«Þ²Ú­«­¢+ÙQ½½±Q¥À ÅÕ½ÐìIÕ¹¹¥¹±¥¹èÅÕ½ÐìµÀìMÉ¥ÁÑ1¥¹9յȰÄÔ°ØàÔ°ÅÕ½ÐíÕ¥¹ÍÉ¥ÁÐèÅÕ½ÐìµÀìMÉ¥ÁÑ9µ°Ä

I'm thinking that maybe if I put this in a While...Wend loop then I can pass the current @ScriptLineNumber to a variable and use that variable in the ToolTip instead of "& @ScriptLineNumber,". Is my logic flawed? Any thoughts? Thanks in advance! I'm going to try my While...Wend idea next.

.... To Be Continued .......

Share this post


Link to post
Share on other sites

I'm thinking that maybe if I put this in a While...Wend loop then I can pass the current @ScriptLineNumber to a variable and use that variable in the ToolTip instead of "& @ScriptLineNumber,". Is my logic flawed? Any thoughts? Thanks in advance! I'm going to try my While...Wend idea next.

.... To Be Continued .......

I don't see why one would pass it to a variable?


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

I'm thinking that maybe if I put this in a While...Wend loop then I can pass the current @ScriptLineNumber to a variable and use that variable in the ToolTip instead of "& @ScriptLineNumber,". Is my logic flawed? Any thoughts? Thanks in advance! I'm going to try my While...Wend idea next.

.... To Be Continued .......

I don't see why one would pass it to a variable?

Hmmm.... it appears that its not obvious that I'm new to scripting and that I don't know what I'm doing. Not sure if that's a good or bad thing - LOL. Anyways, thanks for the question Blue_Drache. Perhaps you have a suggestion on how the ToolTip would automatically refresh the @ScriptLineNumber as a script (with 50 line of code) runs from start to finish.

For example if you run the following script the ToolTip will only display "Running line: 1" since that is the ToolTip line position. What I want is the ToolTip to display "Running line: 1" once kicked off, then "Running line: 3" when the script doese the Send("This is some text.") and then it should display "Running line: 8" when the MsgBox(0,"Status", "Script now complete") is processed. And I'd like this to be done without having mutliple ToolTip commands; that's so not the idea.

ToolTip("        Running line: " & @ScriptLineNumber, 15, 685, "Debugging script: " & @ScriptName, 1)
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("This is some text.")
WinClose("Untitled - Notepad")
WinWaitActive("Notepad", "&Yes")
Send("!n")
MsgBox(0,"Status", "Script now complete")

Hopefully this give everyone a better idea of what I'm talking about. It doesn't matter to me how its accomplished as long as the end goal is achieved. So Blue_Drache, got any suggestions there buddy? :)

BTW, for whatever its worth the example code in the help file under Tutorial - Notepad is wrong! Line 6 of the above code is the correct code needed. And those that say the help file is pretty complete, yeah has plenty of low hanging fruit for newbies to find, fix, and report. Just another reason to read the help file.

Share this post


Link to post
Share on other sites

Very nice! Thank you Zedna and I really like your attention to question I asked about Step through features. Go get yourself a ice cream sunday on me! Only thing is I agree with tonedeaf when they said

....... BTW: Why did you choose the .NET framework for this app.

Even dependencies like VB Runtimes, MFC etc. are not desirable.

and Its really a pain to install the .NET 2.0 framework.

I think that's the reason why we all like AutoIt so much.

Maybe I'll email Stumpii to see if they can comment on this low tech approach. Something small and simple, that's all I'm looking for here. And NiTroGen, sorry if I took over your thread. Hopefully this is still on topic in your opinion. Afterall if the stuff can be written to a ToolTip it should be able to capture that data to the console by using something like ConsoleWrite($ToolTipVar).

Wow, Did you see that Blue_Drache??!!??? There's an answer to your question

I don't see why one would pass it to a variable?

Just playing with ya Blue, gotta have a sense of humor or else this world will drive you to smoke, drink, an early grave, or all the above!

Share this post


Link to post
Share on other sites

How about the function name in script?

Any clues to know the name of current running function?

eg

Func Abc()
Consolewrite("Running " & @functionName & "now" & @CRLF)
EndFunc

Give out

Running Abc now

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