[Mi...] Posted January 27, 2022 Share Posted January 27, 2022 I'm attempting to automate our process of versioning programs... because of Autorun and QC-CALC its better to add the version to the filename AFTER it's used. I created this in Version 2019: cur_version_num = getRecordHead("vda_version") complete_folder_path = getActualInspectionDir() part_num = strElement(1," ",getRecordHead("planid")) program_folder_path_to_part_num = subStr(getActualInspectionDir(),1,(inStr(getActualInspectionDir(),part_num)+7)) program_name = "\"+getRecordHead("planid") if (confirm("Would you like to update the version number of the program?"+cr()+" Current Version Number "+cur_version_num+"")) then new_version_num=inquireNumber("Please enter the new version number, remember to update every other instance of this program on other CMMs if applicable"+cr()+" Current Version Number "+cur_version_num+"") zipDir(complete_folder_path) copyFile(program_folder_path_to_part_num+program_name+".zip",program_folder_path_to_part_num+"Archives"+program_name+" Version "+cur_version_num+".zip") deleteFile(complete_folder_path+".zip") setRecordHead("vda_version",new_version_num) endif It works beautifully when saved in the inspection_pre_save.pcm. I could save local or network files and have it do exactly what I wanted, which is .zip the program folder, copy it to an archive folder and add the version number to it's name. However, I was frustrated to learn that the simple .zip() function doesn't work before version 2018... And the copyFile() will not copy a program folder. I think a batch file might be the only solution for all Calypso versions, but I'm not well versed in them at all. Does anybody have any ideas? Link to comment https://qualityforum.zeiss.com/topic/11128-zip-files-with-pcm-before-version-2018/ Share on other sites More sharing options...
[Wa...] Posted January 31, 2022 Share Posted January 31, 2022 The variables from Calypso will need to be stored wherever you can access them. I am using the results folder. You can store your variables using the following. if fileExists(directoryPath("results") + "\cur_version_num.txt") deleteFile(directoryPath("results") + "\cur_version_num.txt") endif addToFile(directoryPath("results") + "\cur_version_num.txt", cur_version_num) The following is what the batch file will look like. @ECHO OFF REM Directory where files that contain the different Calypso vairiables are stored (can be changed) C: CD C:\Users\Public\Documents\Zeiss\CALYPSO\workarea\results REM Read variables stored by Calypso SET /p cur_Version_Num=<cur_version_num.txt SET /p complete_folder_path=<complete_folder_path.txt SET /p part_num=<part_num.txt SET /p program_folder_path_to_part_num=<program_folder_path_to_part_num.txt SET /p program_name=<program_name.txt REM Inquire if version number should be changed :LOOP ECHO Current Version Number: %cur_Version_Num% SET /p Input=Would you like to update the version number of the program? IF /I "%Input%"=="N" (GOTO end) IF /I "%Input%"=="n" (GOTO end) IF /I "%Input%"=="Y" (GOTO updateVerNum) IF /I "%Input%"=="y" (GOTO updateVerNum) ECHO. ECHO Invalid Choice GOTO LOOP :updateVerNum REM Enter the new version number SET /P new_version_num=Enter New Version Number: REM Store new version number in file echo %new_version_num% > new_version_num.txt REM Zip folder powershell Compress-Archive %complete_folder_path% %complete_folder_path%.zip copy %program_folder_path_to_part_num%\%program_name%.zip %program_folder_path_to_part_num%\Archives\%program_name%_Version_%cur_Version_Num%.zip DEL %complete_folder_path%.zip :end You will then have to read the new_version_num.txt file to set your new version in the record head. Link to comment https://qualityforum.zeiss.com/topic/11128-zip-files-with-pcm-before-version-2018/#findComment-54490 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