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!

Procomm 4.8 - PC anywhere - visual basic?

Status
Not open for further replies.

lco02

MIS
Jun 17, 2003
3
US
which of these is the easiest to configure(procomm,pc anywhere,visual basic?) to capture a datastream twice a day. we receive a short pbx report twice a day which was previously going to a serial printer. it broke. we have since setup a pc with windows 2000 with procomm 4.8. we configued it as best we could and see the data. we can manually do a file capture by pressing the icon. and press it again to ready it for the next capture. can this be automated. can this be redirected to a network printer with dos commands?
 
Does the stream start and stop at a certain time? Is there a string that appears that indicates the beginning and the end of the data stream? I take it this occurs automatically without the machine running Procomm needing to do anything to initiate the stream?

If there is a string (or strings) that you can use to detect the beginning and ending of the data, you could use either waitfor or when target commands to detect those strings and turn on the print capture using the printcapture on command, then use printcapture off when the second string has been received.

As long as the network printer is specifed as the default printer in Procomm, you should be able to send print capture jobs to it without any problems.


aspect@aspectscripting.com
 
1. the file(pbx report) comes across mon-fri 730am and 4pm. sat and sun 730am only. it was orignally setup for a printer, so the data comes till its done. if the printer was down, the report was lost.
2. this is a dedicated machine and can be on 24/7. we need for the machine to automatically do a file capture and reset for next incoming report, and know when its suppose to file capture the next time.
3. i believe we can write something to rename the file and send it to a printer.
 
I'll take a look into this at home tonight. I don't think it would be too hard to turn on the print capture at say, 7:20 and 3:50 to account for possible time differences, then turn off the print capture when the stream is done.


aspect@aspectscripting.com
 
I have done this before with Call Center Reports.

It is best to have the PC dedicated and the script running continuously. The script ran in an interruptible loop with "Waitquiet" 300 as the trigger to close the main capture file and begin processing after 5 minutes of no activity. The script found the title of each each report (I had to differentiate between reports, but it could be as simple as finding "REPORT" or "SEQUENCE #" at the top of each report.

Then the lines were collected into a temporary text file and rescrolled on the screen using the playback and printcapture commands.

My version is 1500 line slong because is converts reports into commma delimited tables, but the basic sequence went like this:
Code:
PROC MAIN
String LINE1
Set Capture Overwrite OFF
Set capture file "mainfile.cap"; I used a date driven name
capture ON
WHILE 1 ;loops forever
Waitfor "ACD" forever ;Waiting for report
Waitquiet 300 ;5 minutes after report is done running
capture off
fopen 0 "mainfile.cap" read text ;you may have to play
;with the directory setting
While not feof 0
  fgets 0 LINE1
  if strfind LINE1 "SEQUENCE #" ;review your own reports 
; to find an appropriate trigger
    fopen 1 "temptext.txt" readwrite text     
    fputs 1 LINE1
    while not feof 0 ; This is a nested loop
;   that will look for the end of the report    
    fgets 0 LINE1
    if strfind LINE1 "TOTAL" ; if you do not have one 
;   single trigger avail, use elseif
      fputs 1 LINE1
      exitwhile; Exits the nested loop only
    else
      fputs 1 LINE1
    Endif
  Endwhile; Ends nested loop
  Endif ;End of "SEQUENCE #" if statement  
  Fclose 1 ;Closes the temptext.txt file
  Set Print Orientation Landscape
  Printcapture ON
  Playback "Temptext.txt"                    
  While $Playback
    Yield
  EndWhile
  Pause 5
  Printcapture OFF
  Delfile "temptext.txt"       ;Delete after printing
Endwhile; End of processing the file.
ENDWHILE; End of While 1 statement - will loop back for next report set.
ENDPROC

Robert Harris
 
is it possible to get the whole 1500 lines of script, as we WANT to use comma delimited tables?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top