Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it possible to know in the script if a sub is existing?
Sorry for a late answer.
If you can't check if a Sub exists in the previous script code, why not revert back to the old include guards?
Alternatively, define a unique variable in your include files and use a conditional to only include the file if the variable is not set.
.... except by "trying to use it, with errorlevel=0, and dealing with the error...." 🙂
Or search / read through the code prior the call...?
Not sure If I understand your request, what would be your use case?
I'm using a big library of "include files" where I keep many subs that are considered to be useful for many different scripts, and the scripts are themselves also includefiles.
For instance, I have a sub called "sub_send_mail()". This sub is then used by some other subs that are then used in many different applications.
Basically I would like to make sure Before including a sub in my script, that the sub is not already included by some other include file.
Something like this: "If not exists Sub('sub_send_mail') then (Include=..\scripts\sub_send_mail.qvs)"
/Robert
Fir reference, the answer is no. No way to check that.
Sorry for a late answer.
If you can't check if a Sub exists in the previous script code, why not revert back to the old include guards?
Alternatively, define a unique variable in your include files and use a conditional to only include the file if the variable is not set.
Its just a great feeling when the solution is there and you just don't see it unless you get somone to make you look to the right direction!
Thanks Stefan!
The idea to make variable named as the sub will be a great way to solve it!
regards
Robert