Sign in to follow this  
Followers 0
JuergenF

Get current line number within the runing script

4 posts in this topic

Dear all,

I created a kind of debug mode using the TrayTip Function (see below).

I would like to display the current line number within the script where the call of the function "Statusmsg" was done.

In other words:

How can I find out at runtime which line of the script is processed at the moment ?

_____________________________________________________

Statusmsg("Wait for xxxx","[ Line 165 ]")

.

.

Statusmsg("Wait for yyyyy","[ Line 170 ]")

Statusmsg("Wait for yyyyy","[ Line <Variable for current line number> ]")

Func Statusmsg($msg, $Zeile)

;=================STATUS================

TrayTip("Clear old ToolTip","",0)

TrayTip("", $msg & @LF & $Zeile, 20)

;=======================================

EndFunc

Share this post


Link to post
Share on other sites



Why not use

Opt("TrayIconDebug", 1)
read line number from your tray icon.

Share this post


Link to post
Share on other sites

Why not use

Opt("TrayIconDebug", 1)
read line number from your tray icon.

<{POST_SNAPBACK}>

Great !!

That is just I was looking for.

Thanks a lot

Juergen

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Or for debugging purpuses also ToolTip()s are useful since they shows messages without stopping the script as MsgBox()es allowing seeing evolution of values of variant of what ever you need.

E.g. Why does this returns 0?

msgbox(0,'',_Factor(100))

Func _Factor($iValue)
   Local $c, $result = 1
   
   $iValue = Abs(Int($iValue))
   
   
   For $c = 2 to $iValue
      $result = $result * $c
    ;###### Debug info
      ToolTip($result)
      Sleep(100)
    ;###### Debug info
   Next
   Return $result
EndFunc

Seeing the tooltips it is easy to understand. There is an overflow!!

Edited by ezzetabi

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