11.07.2015 Views

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong>Rem Below is the <strong>VBScript</strong> codeDim objFSO‘ Declare variables and objectsDim objFilePointer, cur_fileSet objFSO = CreateObject(“Scripting.FileSystemObject”) ‘ Instantiate the COM objectSet objFilePointer = New FileSpec‘ Instantiate the Class ObjectobjFilePointer.FileName = “Myfile.mdb” ‘ Assigns “Myfile.mdb” as the file namecur_file = objFilePointer.FileName‘ Retrieves the current file name “Myfile.MDB”Set objFilePointer.FSO = objFSO‘ Assigns an Object to the PropertyobjFilePointer.Delete‘ Executes a Method to delete a fileSet objFilePointer = Nothing‘ Keyword Nothing releases the object memory<strong>VBScript</strong> Class Objects automatically supports two type of Class Events; Class_Initialize andClass_Terminate Events. The code inside the Class_Initialize event executes once when an Objectbased on the Class is first instantiated. Any code put in this event is optional, and is typically used <strong>for</strong>initialization. Code inside the Class_Terminate event executes once just be<strong>for</strong>e the Object based on theClass is destroyed (i.e. Set to Nothing, or the Object goes out of scope). Usage is as follows:Class FileSpecPrivate master_filePrivate master_FSO Private master_filePrivate Sub Class_Initialize‘ Class Object initialization code‘ code goes hereEnd SubPrivate Sub Class_Terminate‘ Class Object termination code‘ code goes hereEnd SubPublic Property Let FileName(strName) ‘ Define a Public Property to assign the file namemaster_file = strNameEnd PropertyPublic Property Get FileName ‘ Define a Public Property to retrieve a file nameFileName = master_fileEnd PropertyPublic Property Set FSO(m_FSO)‘ Define a Public Property <strong>for</strong> an objectSet master_FSO = m_FSOEnd PropertyEnd Class<strong>InduSoft</strong>, Ltd. 27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!