luarken Posted September 15, 2010 Share Posted September 15, 2010 hello I want to make a botton (exit botton) but i want than this button asks ,if you want to exit!!!! and select yes or no!!!! and the next. Changing the logging file name every month. I am trying to make a logging file every month and the first time it works but if the application still working more the a month it doesn't work. because the sequence don't return what I can do???? // get the current month and year: private curmonth = StrToDouble(FormatDateTime("%m",SysTime())) private curyear = StrToDouble(FormatDateTime("%y",SysTime())) private date // loop forever: while (1) // set for retrieving time from year/month: date = Evaluate(Format("%dy%dm1",curyear,curmonth)) // set logging file name: Logging.MyLogging.strFileName = "MyData_" + FormatDateTime("%y_%m.csv",date) // now wait until the first of the next month: curmonth++ if (curmonth > 12) curmonth = 1 curyear++ endif // get time for next month date = Evaluate(Format("%dy%dm1",curyear,curmonth)) // wait until then waituntil(date) endwhile Link to comment Share on other sites More sharing options...
AzeoTech Posted September 16, 2010 Share Posted September 16, 2010 1) quit button: Use the Quick Sequence action and put code like this: if (system.messagebox("Are you sure you want to quit?", "YesNo") == "Yes") system.quit() endif 2) as for the logging file. You have a lot of extra processing here that I don't think is necessary. You really can just do this: while(1) logging.mylogging.strFileName = "MyData_" + formatDateTime("%y_%m.csv", systime()) delay(1) endwhile This works because the line that sets the file name just sets it to the same thing until the month turns over. Run this sequence at priority 0. Link to comment Share on other sites More sharing options...
luarken Posted September 17, 2010 Author Share Posted September 17, 2010 thanks for u help!!! it works, but respect to the second answer. how I can do, so that the Sequence always look for, what is the current month??? because this Sequence while(1) logging.mylogging.strFileName = "MyData_" + formatDateTime("%y_%m.csv", systime()) delay(1) endwhile only works one time, later the sequence stops. dont look for, what is the current month. I need that the application is open all the year. Link to comment Share on other sites More sharing options...
AzeoTech Posted September 17, 2010 Share Posted September 17, 2010 Unless you typed it in wrong, the sequence I provided will run forever. The while(1) ensures this. Does anything appear in the Command/Alert window? Link to comment Share on other sites More sharing options...
luarken Posted September 18, 2010 Author Share Posted September 18, 2010 thanks it works very well, but, for example if I change the month in my computer, a new file is not created Link to comment Share on other sites More sharing options...
AzeoTech Posted September 21, 2010 Share Posted September 21, 2010 That's because once you start DAQFactory it no longer uses the system clock. Any changes to the system clock won't affect DAQFactory until you restart it. This is because the system clock is not precise. DAQFactory instead uses the high precision clock which is not tied to the system clock. So, unfortunately, you can't test it by simply changing the clock. You'll have to wait until the month changes over. You could test this by setting the date to 10 minutes before the end of the month BEFORE you start DAQFactory and simply wait 10 minutes until it turns over. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.