Jump to content

Get current line number within the runing script


JuergenF
 Share

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...