Include a file: Difference between revisions
Content added Content deleted
(Added example) |
|||
Line 1,150: | Line 1,150: | ||
<lang vbscript> |
<lang vbscript> |
||
<script id="Connections" language="VBScript" src="D:\include\ConnectionStrings.vbs"/> |
<script id="Connections" language="VBScript" src="D:\include\ConnectionStrings.vbs"/> |
||
</lang> |
|||
If you use the following form then you can define an environment variable, %INCLUDE% and make your include library more portable as in |
|||
<lang vbscript> |
|||
Include "%INCLUDE%\StrFuncs.vbs" |
|||
Function Include ( ByVal file ) |
|||
Dim wso: Set wso = CreateObject("Wscript.Shell") |
|||
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject") |
|||
ExecuteGlobal(fso.OpenTextFile(wso.ExpandEnvironmentStrings(file)).ReadAll) |
|||
End Function |
|||
</lang> |
</lang> |
||