Search This Blog

Tuesday, January 18, 2011

How to call the Functions in other libraries

'Create file system object

Set fso=CreateObject("scripting.filesystemobject")
'Open library fileSet sFile=fso.OpenTextFile("C:\Documents and Settings\sudhakar kakunuri\Desktop\Script Control\source.vbs")
'Read the complete data from library fileSourceLibraryData=sFile.ReadAll'
close the files
File.Close
'Create Script Control Object
Set scrControl=CreateObject("msscriptcontrol.scriptcontrol")
'Specify the language to be controlled
scrControl.Language = "VBScript"
'Add the source library code
scrControl.AddCode(SourceLibraryData)
 'Diplay the number of procedures in th source library
MsgBox scrControl.Procedures.Count,,"Total Procedures Count"
'Display value of a variable in source library
Msgbox scrControl.Eval("a"),,"Value of Variable 'a'"
'Executing the function source library function
scrControl.Run "demo"
'Executing the function source library function with parameters
msgbox scrControl.Run("demo_add",10,20),,"demo_add function Result"