I needed to use "scripByName" in a production solution. I wanted to modify the existing code as little as possible.
At the beginning of any script we want it to return its name. Before any existing code, I write
If [ $$yDesn_GetScriptNameOnly ]
Set Variable [ $$yDesn_GetScriptNameOnly ; Value: "" ]
Exit Script [ Text Result: Get ( ScriptName ) ]
In the script where I want to know the name before passing it in parameter I write:
Set Variable [ $$yDesn_GetScriptNameOnly ; Value: True ]
Perform Script [ Specified: From list ; “ScriptThatDoesSomething” ; Parameter: ]
Set Variable [ $scriptNameToCallBack ; Value: Get ( ScriptResult ) ]
Perform Script [ Specified: From list ; “ScriptThatDoesSomethingElse” ; Parameter: $scriptNameToCallBack ]
No script name written in hard
No need to manage the ID script
Can be used in scripts with or without parameters.
This is not a question ... but hey there is worse