Sample VBScript Program

Top  Previous  Next

 

FileLink may be called from VBScript (VBS) programs. The following is an example VBS program that loads FileLink, dials the modem to connect to a remote system, retrieves and displays the value of an internal FileLink variable, and then disconnects.

 

' Instantiate a FileLink object

' -----------------------------

Set FLReq = Createobject("FLAutomation.Automate")

If err.number <> 0 then

Wscript.quit 1

End If

' Set connection properties and open connection

' ---------------------------------------------

ResultCode = FLReq.FLStartSession( "Sample", 1, True, False, "" )

If ResultCode <> -1 then msgbox "FileLink Connection Error occured!"

FLReq.FLEndSession

WScript.quit 2

End If

' dial the remote system

' ----------------------

cmdString = "DIAL '555-1212'"

ResultCode = FLReq.FLSendCommand( cmdString, 600)

' get the last error

' ------------------

msgbox FLReq.FLGetVBSVariable("%lasterror" )

 

' disconnect from remote system

' -----------------------------

cmdString = "DISCONNECT"

ResultCode = FLPReq.FLSendCommand( cmdString, 600)

' end FileLink session and exit

' -----------------------------

FLReq.FLEndSession

Wscript.Quit 0