Mobile Data StudioObject Model › Accessing the Filesystem

A common task is to access files on the server, either reading in data, or writing out data, possibly from a Session.

The easiest way to do this is to use FileSystemObject. See that link for full documentation from Microsoft.

To instantiate a FileSystemObject:

Set fso = CreateObject( "Scripting.FileSystemObject" )

Writing to a File

For example, to write some data from a session to a file when the session is received:

Function OnIncomingSession ( Session )

Set fso = CreateObject( "Scripting.FileSystemObject" )
Set file = fso.CreateTextFile( "c:\filename.txt", True )

file.WriteLine "Received a session from " & Session.UnitID & ":"
file.WriteLine "PointName1 = " & Session("PointName1")
file.WriteLine "PointName2 = " & Session("PointName2")

file.Close

OnIncomingSession = True

End Function