[Br...] Posted October 4, 2021 Share Posted October 4, 2021 I'm trying to rename a text file, that I'm exporting under "Resources" - "name for output files". I'm exporting out the features table as a text file. But I need to change the name of the output. current out look like: PH1_Rev_01-VN_test_2021-10-4_11_06_48 am.txt Needs to be like: PH1 Rev 01-VN test_2021-10-04_110648.txt Anyone have some suggestions on how to go about this task using PCM.features table_Calypso.pdf Link to comment Share on other sites More sharing options...
[Mi...] Posted October 4, 2021 Share Posted October 4, 2021 It's not going to be that simple, but I can give you some code I wrote to copy the files and change the name, in my case I'm adding underscores, you are removing but the principal is the same. Where I used copyFile(), you would use renameFile(), pay attention to how I sectioned the time and dates so I could add the underscores, you need to do the same so you can change the underscore to spaces. Once you get it working put it in the post settings for your program and it'll do it every time. //Copies table files to new location for use with QC-CALC //------Variable Declaration------ planName=getRecordHead("planid") planIncPartNum=getRecordHead("partnbinc") planDate=getRecordHead("date") planMachNum=getRecordHead("procid") planHour=strElement(1,":",getRecordHead("time")) planMinute=strElement(2,":",getRecordHead("time")) planSecond=strElement(3,":",getRecordHead("time")) //------File Name Creation------ planFileNameCALYPSO=planName+"_"+planIncPartNum+"_"+planMachNum+"_"+planDate+"_"+planHour+"_"+planMinute+"_"+planSecond planFileNameQCCALC=planName+planIncPartNum //------Copy Results Table Files from standard results directory, to a new one just for QC-CALC copyFile("C:\data\cmm\stf\results"+"\"+planFileNameCALYPSO+"_chr.txt","C:\data\cmm\stf\results QC-CALC"+"\"+planFileNameQCCALC+"_chr.txt") copyFile("C:\data\cmm\stf\results"+"\"+planFileNameCALYPSO+"_hdr.txt","C:\data\cmm\stf\results QC-CALC"+"\"+planFileNameQCCALC+"_hdr.txt") copyFile("C:\data\cmm\stf\results"+"\"+planFileNameCALYPSO+"_fet.txt","C:\data\cmm\stf\results QC-CALC"+"\"+planFileNameQCCALC+"_fet.txt") Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in