asaikk Posted November 13, 2012 Share Posted November 13, 2012 Hello, What would the script for "Save" the ctl file which is currently run? The problem I have is as below ; (1)We start up and shut down a ctl program every day where logging is carried out in a sequence such as below: logging.log.strFileName = "C:\DailyLog" + formatdateTime("%y%m%d",systime()) + ".csv" (This line is run every 10 seconds.) Closing the ctl file is carried out by "System.Quit()" command. (2)The problem is, a log file is made at once when the ctl is started whose name does not correspond to today, but to the day when this ctl file was made. (After the first log file is made, another log file with proper name corresonding to today is created later.) (3)I estimate the reason that the first log file is made before the sequence is run, therefore made on the default information kept on the logging set. (4)In order to test this hypothesis, I saved the ctl file by "Save", then the newly saved ctl file stopped to create the log file with wrong name. (5)Thererfore I think it effective for avoiding the problem above to put in and run everyday a sequence where "Save" is carried out. Thank you in advance. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 13, 2012 Share Posted November 13, 2012 System.saveDocument() will save the document, but I don't suggest that for your issue. Using saveDocument() is simply chasing the symptoms. You should instead unmark the "AutoStart" option of logging set, then in your Auto-Start sequence, set the file name for the logging to the proper date, THEN start the logging set. Something like: logging.log.strFileName = .... beginlogging(log) In general I recommend selecting one sequence as AutoStart and then for everything else, including logging sets, PID loops and the like, leave the AutoStart unchecked. In that one sequence you can then start all the other items in an order that you can predict. The ability to AutoStart multiple items is really designed for people with really small systems that aren't really doing any scripting and just want to take some data and log it right from start up. Link to comment Share on other sites More sharing options...
asaikk Posted November 14, 2012 Author Share Posted November 14, 2012 Thank you for your quick reply. And I am supremely grateful for your suggestion. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.