[Cl...] Posted September 17, 2020 Share Posted September 17, 2020 Presettings Part_Type = inquireList("Are you running a Set-up Part or full Production?","Set-up","Production") selectCase Part_Type case "Set-up" setRecordHead("partid","Set-up") case "Production" setRecordHead("partid","Production") endSelect *************************************************************************************************************** Postsettings filePath = "T:\DMR\CMM Data\10122X Op-10_Rev_A\"+ getRecordHead("planid")+ getRecordHead("partnbinc")+".txt" if fileExists(filePath) then // if it can't find the file then it will not error out. endif if Part_Type == "Set-up" copyFile(filePath,"T:\DMR\CMM Data\10122X_Set-up\theresults.txt") endif *************************************************************************************************************** When the operator chooses "Set-up" the report goes to the 10122X Set-up folder like it's supposed to. It also goes to the filePath = "T:\DMR\CMM Data\10122X Op-10_Rev_A\"+ getRecordHead("planid")+ getRecordHead("partnbinc")+".txt". I don't want it to go there Link to comment Share on other sites More sharing options...
[Er...] Posted September 17, 2020 Share Posted September 17, 2020 It's because you only copy the file to another location. You dont move it, or delete the old one. //Pre-settings setRecordHead("partid",inquireList("Are you running a Set-up Part or full Production?","Set-up","Production")) //Post-settings filePath = "T:\DMR\CMM Data\10122X Op-10_Rev_A\"+ getRecordHead("planid")+ getRecordHead("partnbinc")+".txt" if fileExists(filePath) // if it can't find the file then it will not error out. if getRecordHead("partid") == "Set-up" copyFile(filePath,"T:\DMR\CMM Data\10122X_Set-up\theresults.txt") deleteFile(filePath) endif endif I took the liberty to clean it up. A good practice is to not introduce variables unless necessary. "partid" is is already stored in "record head". selectCase is not really necessary either. It only slows it up. Your fileExist() did't do anything. It would error out anyway. This because you stop the if-statement pre-mature. Hope it helps a bit. Link to comment Share on other sites More sharing options...
[Cl...] Posted September 17, 2020 Author Share Posted September 17, 2020 Thanks Eric! I'm still learning. 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