The below is a slightly cleaned up version of what I am trying to do.
To summarize, I want to have the script watching for the *CSV TRIGGER* string, grab the file name, open a capture file using that name, capture the data, close the file, clean up after itself.
All seems to work as I wish when the PROCOMM window is first opened. If the window is left opened, there is something that seems to "break" the when-target-while continuous loop. When broken, the string will not invoke the desired response. If I go in and start up a different script and then restart this one it starts working again.
when the loop is "broken" I can see the "running man" and it appears that the script is still active. If I close the window I get the prompt asking if I want to close all scripts (like it is active).
any ideas what is fouling my continuous loop? I would like to have the script be able to respond to the trigger several times in one session. I have *not* been able to identify what (or when) is actually breaking the script. It seems to work for awhile.
Thanks,
-Ted
string file_name
string orig_capture_path
string orig_capture_file
proc main
when target 0 "*CSV TRIGGER*" call get_fname_and_capture
while 1
yield ; puts it in a continuous loop
endwhile
endproc
proc get_fname_and_capture
fetch capture file orig_capture_file ; grabs the default capture file name
fetch capture path orig_capture_path ; same for the default path
set aspect rgetchar 90 STRIP ; sets the rget end character to Z
rget file_name ; picks uf the filename
set capture file file_name ; renames the capture file name
capture on
sendkey 13 ; sends the <enter> key twice
sendkey 13 ; start the data capture
waitfor " " FOREVER
; wait for end of doc (& over-ride the 30 second default timeout)
capture off ; turns off data capture
set aspect rgetchar 13 STRIP ; resets the rget end character to default (CR)
set capture file orig_capture_file ; returns your capture file name to the default
set capture path orig_capture_path ; same with capture path
endproc
To summarize, I want to have the script watching for the *CSV TRIGGER* string, grab the file name, open a capture file using that name, capture the data, close the file, clean up after itself.
All seems to work as I wish when the PROCOMM window is first opened. If the window is left opened, there is something that seems to "break" the when-target-while continuous loop. When broken, the string will not invoke the desired response. If I go in and start up a different script and then restart this one it starts working again.
when the loop is "broken" I can see the "running man" and it appears that the script is still active. If I close the window I get the prompt asking if I want to close all scripts (like it is active).
any ideas what is fouling my continuous loop? I would like to have the script be able to respond to the trigger several times in one session. I have *not* been able to identify what (or when) is actually breaking the script. It seems to work for awhile.
Thanks,
-Ted
string file_name
string orig_capture_path
string orig_capture_file
proc main
when target 0 "*CSV TRIGGER*" call get_fname_and_capture
while 1
yield ; puts it in a continuous loop
endwhile
endproc
proc get_fname_and_capture
fetch capture file orig_capture_file ; grabs the default capture file name
fetch capture path orig_capture_path ; same for the default path
set aspect rgetchar 90 STRIP ; sets the rget end character to Z
rget file_name ; picks uf the filename
set capture file file_name ; renames the capture file name
capture on
sendkey 13 ; sends the <enter> key twice
sendkey 13 ; start the data capture
waitfor " " FOREVER
; wait for end of doc (& over-ride the 30 second default timeout)
capture off ; turns off data capture
set aspect rgetchar 13 STRIP ; resets the rget end character to default (CR)
set capture file orig_capture_file ; returns your capture file name to the default
set capture path orig_capture_path ; same with capture path
endproc