We've all wanted to be able to have script that says:
if <condition> then
INCLUDE XYZ.inc
else
INCLUDE ABC.inc
end if
WELL NOW YOU CAN, and it works in ASP too.
Watch out though. If you get a VBS (or ASP) error, the line numbers do not tally up to where the problem really is.
---------------------
'# ADD THIS TO THE BEGINNING OF YOUR SCRIPT
dim fso
set fso = createObject( "Scripting.FileSystemObject" )
include("anotherfile.inc"
testme()
'# ADD THIS TO THE END OF YOUR SCRIPT
'# Include another file
Sub Include( sPath )
dim oFile
Const ForReading = 1
set oFile= fs
executeGlobal( oFile.ReadAll() )
oFile.Close
End Sub
'# NOW CREATE A FILE CALLED ANOTHERFILE.INC WITH THIS IN IT
sub TestMe()
msgbox( "Hi it's working" )
end sub
------------------
You can now put all those subroutines into a seperate file and not have to paste them into every script you write.