Sample Script to Connect to Network Address
Return to Script Contents

This script is usually a file called 'connect'.  The first thing one must do, is destroy any prior reference to the macro.  If the macro already does exist, subsequent commands will be added to it, but will probably never be executed.

/dest connect
#create macro with one parameter named 'where'
/mac connect where #Open the data channel to a TCP device
#using the parameter 'where' passed to the macro.
/parse tcp %where
#If the connection is established,
#the command succeeds...
/if success #turn on formatted input (line mode parse)
/format on
#declare a blank variable called 'line'
/decl line
#mark this as a potential place to /GOTO
/label top #get a line from the data channel
/getline %line
#if there was a line, this
#command succeeds
/if success #this macro ignores blank lines.
/compare %line blank
#if it FAILS being blank...
/if fail #use formatted echo to show
#the line input.
/fecho %line
#make line BLANK
/decl line
/endif
/else #there as no data available to
#get from the data channel.
#test to see if the device
#is still connected.
/compare connected
/if fail #Device was disconnected.
/echo Connection closed.
/goto done
/endif
/endif
#jump up to the beginning
#constant loop while connected.
/goto top
/endif
/label done
#close the data channel
/endparse
/endmac
Return to Script Contents