cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
john_madden
Level VI

Get currently executing line number of script as a variable

I'd like to send progress messages to the log that include the currently executing line number of the script. If I never changed the script of course I could just hard-code the line number into the message. But when I add/delete lines in the course of editing, the line numbers change. So is there a function that gives you the currently executing line number, so I could incorporate something like

Write("The script has now progressed to line number ", CurrentlyExecutingLine())
2 REPLIES 2
mmarchandTSI
Level V

Re: Get currently executing line number of script as a variable

It doesn't appear this is an option, but perhaps this workaround will do the trick for you.  Put the entire text of the script into a variable at the beginning of the script.  First line could be something like

script_text = Load Text File( "Path\script.jsl" );

Then, whenever you want to tell the user what line is executing,

//marker001
Write( "The script has now progressed to line number ", Contains( Words( script_text, "\!N" ), "//marker001" ) + 1 );

 Just make sure "//marker###" is the only text on its line.

john_madden
Level VI

Re: Get currently executing line number of script as a variable

Thanks. You'll admit, I'm sure, that it's kluge-y. But it's definitely clever!