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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Script Needed

Status
Not open for further replies.

ShorePatrol

Programmer
Mar 19, 2003
18
US
Hi All,

I need a fairly easy script, but I don't have "any" aspect scripting experience...please help!!!

I am currently monitoring a modem's data with Procomm (Latest Version)...the modem receives a few numbers and a # sign every once in a while (ex. 42212#)

Here's what I need the script to do:

First Clear the screen
Capture all incoming data, and when it see a # sign, grab the data to a text file....with a file name of the TIME- hour/minute/seconds (so there are no duplicates)
Then clear the screen and wait for more data...repeat when a #sign is ecountered...so a text file might look like:

32212#
or
43321#

Can someone help me out?

Thanks!!!
 
Something like this might work for you:

proc main
string sCapPath, sCapFile, sCapFile2, sNewFile
integer iDay, iMonth, iYear, iHour, iMin, iSec

set capture file "temp.txt"
fetch capture path sCapPath

while 1
clear
capture on
waitfor "#" forever
capture off
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt sNewFile "%02d%02d%02d" iHour iMin iSec
strcat sNewFile ".TXT"
strfmt sCapFile "%s\temp.txt" sCapPath
strfmt sCapFile2 "%s\%s" sCapPath sNewFile
shortpath sCapFile sCapFile
rename sCapFile sCapFile2
endwhile
endproc

aspect@aspectscripting.com
 
Wow - THANK YOU...It works wonderfully!

Could you possibly walk me through "peudocode-like" what your script is doing?

I see your capturing to a temp file, then copying it to the real file....why is this necessary (just curious)...

I guess I just don't understand Procomms Script Structure, like the WHILE 1, etc...

In any case, thanks for your help!!! Thank goodness for helpful people like you!
 
While 1 causes the script to loop endlessly. The clear command clears the screen, then the capture file is opened. The script then pauses waiting for the # key forever (the waitfor command expires after 30 seconds by default unless you override that timeout value). Once a # character is received, the capture file is closed, then a new name for the capture file based on the hour, minute, and second is determined, and the original file (temp.txt) is renamed to the computed filename.

The script uses temp.txt as the initial capture file since it won't know until later the exact time the capture file was saved (for example, if it could be waiting hours until data comes in).

aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top