hexagon logo

Writing/Reading a .txt file

This is very much a VB question not related to PC-DMIS. There is so much information out there for VB that I find it very hard to locate a good example of what I want to do.

I have a script at the beginning and end of my part program. I would like to get the total runtime of the program. I have a way to get systemtime in each and put it into seconds and such, thanks to this message board.

I do not want to write the beginning time to a variable and have it go through the part program. What I wanted was a temporary .txt file or something similar that I could write the begintime value (in seconds) to. The second script would grab this value and use it. The .txt file either needs to be cleared or overwritten by the new begintime number every execution. How do I code this?

My goal is to take these values and use them to calculate CMM run time for the day in Excel. Can I export the Total Runtime number I get in the second script to Excel? It will probably be easier to google information for this; I will update this post if I find what I am looking for.

Thanks!
Parents
  • if you place a comma in between each piece of data Excel will import and sort this data almost automaticlly into seperate cells. As long as each line in your log file contains the data formated in the same way, which it should if you place it in there through scripting, it will format the data very nicely. If you plan on evenutally putting this data into charts you will not want to mix data types in beyween commas, ie 200=runtime in seconds, would be a no-no. If you know the order of the fields you can create a worksheet for the charting that you plan to do, open your log file into excel and then paste the data from that log file directly into your worksheet and be done.
Reply
  • if you place a comma in between each piece of data Excel will import and sort this data almost automaticlly into seperate cells. As long as each line in your log file contains the data formated in the same way, which it should if you place it in there through scripting, it will format the data very nicely. If you plan on evenutally putting this data into charts you will not want to mix data types in beyween commas, ie 200=runtime in seconds, would be a no-no. If you know the order of the fields you can create a worksheet for the charting that you plan to do, open your log file into excel and then paste the data from that log file directly into your worksheet and be done.
Children
No Data