Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Text Files with Procomm 1

Status
Not open for further replies.

meikle

Programmer
Dec 4, 2003
2
GB
Hi.

I'm new to Procomm but have managed to put together a useful script that saves me from having to type information into a screen by reading records from a text file that "cuts & pastes" various strings from within the record into the various fields on the screen, i.e. the script reads a record then
outputs the first string into the first field,
outputs the "tab" command
outputs the second string into the second field,
outputs the "tab" command,
etc.

The scripts works perfectly when the string being output has less characters than the field it is being output to.

The problem I have is when the string being output has the maximum number of characters that the field on the screen can accept.

When this happens the field that I output the string to automatically tabs to the next field.

I was wondering whether there is any way within the script that I could check the length/number of characters within the string to see whether it is equal to the maximum length of the field on the screen so that I could a "IF / Else" command to decide whether to send the "TAB" command or not!
 
You can use the strlen command to get the length of the string and then handle as appropriate. Something like this would be what you would end up with:

strlen sVar iLength
transmit sVar
if iLength < maxval
transmit "`t"
endif

In the snippet above, replace maxval with the actual integer value that is the maximum width of the field.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top