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!

How to find if a Capture File is already open

Status
Not open for further replies.

Shanondink

Technical User
Sep 9, 2002
29
US

I've been all through the Help files and this forum. I have been writing Aspect scripts for about 2 years but now I am stumped!

Important:
1. I want my script to check if a capture file is already on before I turn one on. But I can't figure out how.

My Rambling:
2. If I start Procomm, and immediately hit the capture button to turn on a capture file. It makes a pw01.cap. But if I run the following script, it show's [NONE]. I thought that it should show pw01.cap. Even if I uncomment "capture on", it creates "pw01.cap" but still shows [NONE]. Shouldn't it show "pw01.cap"? After I turn capture off and run this, it shows "test.txt", shouldn't it show [NONE].

It's driving me nuts.

# START of SCRIPT #######
string szFileName

proc main

; set capture file "test.txt"

; capture on

fetch capture file szFileName

statmsg "Capture file is: %s" szFileName

endproc
 
If you check the value of the $CAPTURE system variable, you will get a 0 if no capture file is open and a non-zero value if a capture file is open.

When you mention the different values that are being displayed, I assume you are saying what the values of the capture file are. The capture file value is valid, even though you may not have a capture file open. If I've misunderstood your question, please followup and let me know!
aspect@aspectscripting.com
 
Hello,

I tried this and it worked fine. I saw the Statmsg and the Hello from Procomm was written to the File. The User message Indicated the Capture Status

string szFileName

proc main
set capture overwrite on
set capture file "test.txt"
set capture path "C:\DMS 100"
capture on
fetch capture file szFileName
statclear
statmsg "Capture file is: %s" szFileName
Termwrites "Hello from Procomm"
Termwrites "`r`n"
If $CAPTURE == 1
Usermsg "Capture on"
Endif
pause 10
statclear
capture off
If $CAPTURE == 0
Usermsg "Capture off"
Endif
endproc

Hank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top