DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Name of Current Execution Script

Solved!
Go to solution

Hello,

 

I am looking to get the name of the current script that is running in DIadem.

 

So I woudl like to call a script, and then while it is running I would like to record the name of the script (file name on disk) to a text box on a report I am generating.

 

I know how to pass values to the report I am not sure to get the name of the current script that is executing.

 

Thanks

Tim
0 Kudos
Message 1 of 4
(5,050 Views)
Solution
Accepted by topic author smoothdurban

Hi Tim

 

You can use the variables CurrentScriptName and CurrentScriptPath.

 

Hope this helps.

Winfried

0 Kudos
Message 2 of 4
(5,046 Views)

Awesome Thanks

Tim
0 Kudos
Message 3 of 4
(5,039 Views)

Be aware that the currentScript... command only return the correct path in global script context.

If you use it in scripts that you include you have to store them in gloabl variables to access them.

 

Lets assume a script foo2.vbs in a subfolder lib

 

Option Explicit  'Forces the explicit declaration of all the variables in a script.

dim foo2path : foo2path = CurrentScriptPath
dim foo2Script : foo2Script = CurrentScriptName

function Foo2Pathinfo()

  dim rv : rv = ""
  rv = rv & "foo2 path: " & foo2path & VBCRLF
  rv = rv & "foo2 script: " & foo2Script & VBCRLF
  rv = rv & "foo2 curr path: " & CurrentScriptPath & VBCRLF
  rv = rv & "foo2 curr script: " & CurrentScriptName & VBCRLF

  Foo2Pathinfo = rv

end function

And a script using it

 

 

Option Explicit 

scriptinclude currentscriptpath & "lib\foo2.vbs"

MsgBox "foo1 curr path: " & CurrentScriptPath & VBCRLF &_
       "foo1 curr script: " & CurrentScriptName & VBCRLF &_
      Foo2Pathinfo()

This will output

 

foo1 curr path: C:\temp\
foo1 curr script: foo1.vbs
foo2 path: C:\temp\lib\
foo2 script: foo2.vbs
foo2 curr path: C:\temp\
foo2 curr script: foo1.vbs

Where the last lines are potentially not what you expect.

 

0 Kudos
Message 4 of 4
(5,020 Views)