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!

Direct Connect Capture 24/7

Status
Not open for further replies.

hankm3

Programmer
Jan 27, 2002
284
US
Knob,

Maybe You or someone else Might steer me in the Best Direction.. This is my Task...
Have to set Up a PC as a Collection Point for Data.. The PC will have a Direct Connect Via Com Port to a Switch, that Output Logs every 15-30-60 Minutes. Each Log has a Different Header. Have that Part Covered. My Question is this.... The Procomm Script MUST Run Constantly 24/7 without Killing the PC Resource Time...
I have the Capture Time Set to 1 Minute Prior to Each Log Message and Capture will end 1 Minute Later.... I think the YIELD Command will do this but will this Keep the PC from Restarting ??? In your Experience ,,, Will YIELD do the Job for this Time Period..
Should the Following work, or would you suggest something different ??

Idea 1:

While $CONNECTION
YIELD

when Target 0 "Collect: 112" Call proc Message1()
.......

when Target 1 "Collect: 110" Call proc Message2()
..........

YIELD
endwhile

Idea 2:

While $CONNECTION
Yield

### If Time is Correct, Capture Turns On #####

waitfor "Collect: 110"

### Wait 1 Minute and Turn Off #######

Collect110()

### If Time is Correct, Capture Turns On #####

waitfor "Collect: 112"

### Wait 1 Minute and Turn Off #######

Collect112()

endwhile

 
When you are talking about the PC resource time, are you saying that you want to find a way to keep Procomm from eating up all of the available CPU time? If so, then yield is the command to use to not "hog" the CPU as much. I'm not aware of any cases where using the yield command should cause the restart of the computer.

As for your two examples, I think they are equally viable. The only changes I would make in the first script is that the when commands should be outside (before) the while loop, otherwise you will be rapidly redefining the when commands each time through the loop. As for the second script, I think it should work fine as well, although you'll need to add some logic to turn the capture file on and off at the right time, as you've mentioned. The advice I would offer here is to make sure that you are checking the success/failure of each command so that you progress through the different commands in the while loop quickly (basically make sure that you don't get stuck in waitfor commands when the time is not correct and similar situations). The reason I say this is that not doing so could theoretically cause one or both of the captures to not work correctly if you happened to be stuck in the logic for one capture process when it is time to be capturing the data for the other capture process.
 
Thanks Knob,

That answered by question. Yes, the Restart statement should have been Procomm Script Hogging the CPU Time in a way that the PC would Just Lock Up. As far as the Logic goes I think I have that covered. What I want to do is DDE the Capture Files after they are Closed. In other words, Wait for the Message, Process it, DDE it out and then Wait for the Next Message, so on and so Forth..

Which brings Up another Question ?? If I Build this around a Dialog Box, would a ABORT Pushbutton work so I could Stop the Script and do a Cleanup Procedure ?

Thanks Again
 
Regarding the usage of resources, you could have your script restart Windows (using the exitwindows REBOOT command) at a set time each day if there would be a time that would be safe to do this. You could then have a shortcut to Procomm and your script in the Startup group that would be automatically executed each time Windows restarted. This would be one way to mitigate any resource leaks that you may encounter.

As for the Abort pushbutton, that should be pretty easy to implement. If you look at the example for the pushbutton command, your case would be similar to case 1, where exitwhile is called. Afte the exitwhile, you would want to use dlgdestroy to destory the dialog, and then you could call your cleanup script. You could theoretically just call your cleanup script from within the case statement and issue the dlgdestroy and other cleanup commands there, but there may be some weird behavior if you do so (just a possibility off the top of my head, it could work OK as I have not tested that theory).
 
Knob,

Thanks for the Tips. Hope I don't have to Resort to a Restart. If YIELD will free up the CPU, then I should be OK. This will be a PC Storage Unit that will not be Running any other Apps. Hope to setup the PC so I can Remote Login into it and Extract the Closed Excel Files that will be Closed Via DDE Command. Hope to use a 1.2 - 2.0 Mhz CPU and 512 Meg Ram so Resources will not get Hosed...

The ABORT Option would be Used when the Procomm Script Needed to be Closed for Maintenance on the PC or Script Modifications within a Logging Window.

Thanks Again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top