Professional > Getting started with UNICOM Intelligence Professional > Working with a common Microsoft object
 
Working with a common Microsoft object
To demonstrate working with a common Microsoft object, next you will create a Microsoft Scripting FileSystemObject and use it to create a text file.
1 Enter the following:
Dim FSO, MyTextFile

Set FSO = CreateObject("Scripting.FileSystemObject")
MyTextFile = FSO.
Even though the FileSystemObject is not an UNICOM Intelligence object, this activates the ScriptAssist feature and opens a list of the object's properties and methods. The ScriptAssist feature is available for all suitable COM object models that are created using the CreateObject function. Note that when the ScriptAssist feature is available for an object, the object's type library will also be included in the Types pane. However, the type library does not show in the Types pane until you reference the object and type the dot (.) that activates the ScriptAssist feature.
UNICOM Intelligence Professional can usually find type libraries for scriptable object models so that the ScriptAssist feature works. If it does not appear for the object model that you are using, you can map the type library manually. To do this, open this file:
C:\Program Files\IBM\SPSS\DataCollection\version_number\Professional\ExtrernalInterfaces.xml
The file contains some interface lines, like this:
<Interface PROGID="Word.Application" TYPELIBUUID="00020905-0000-0000-C000-000000000046" />
These lines map the PROGID that you use with CreateObject to the type library that defines the properties and methods. You can find the PROGID to type library mapping in the registry under HKEY_CLASSES_ROOT. Find the PROGID in the list, and then retrieve the type library ID from the CLSID.
2 From the list, select the CreateTextFile method, and then type the opening parenthesis:
(
Again, this makes UNICOM Intelligence Professional display details of the method's parameters.
3 Enter a name, and optionally the location, for the new text file, and then use the Dim statement to define a variable called MyVariableInstance. For example:
MyTextFile = FSO.CreateTextFile("MyVariables.txt")
Dim MyVariableInstance
Next
Creating a macro to insert common code
See also
Getting started with UNICOM Intelligence Professional