10-25-2018 02:23 AM
Hello,
is there a way to check if DIAdem script started directly?
In Python there is:
if __name__ == "__main__":
main()
With this functionality I could separate functionality for the script when it is imported by another script and when it is run directly.
Solved! Go to Solution.
10-26-2018 02:25 AM
There is no direct way but you could use SubSequence and some error handling.
bMain() sub bMain() on error resume next call SubSequence() : if 0 = err.number then exit sub on error goto 0 MsgBox "Execute main" end sub
Here are two example scripts to check
a.vbs
Option Explicit scriptinclude currentScriptPath & "b.vbs" call b()
b.vbs
Option Explicit sub b() MsgBox "b called" end sub bMain() sub bMain() on error resume next call SubSequence() : if 0 = err.number then exit sub on error goto 0 MsgBox "Execute main" end sub