hexagon logo

Basic script error in PC-DMIS

Any help would be appreciated here. I keep getting an error message that pops up when trying to run a basic script. I've used this same script for months now, and never had any issues. now all of the sudden on 1 machine, I am getting this error. I see nothing wrong with the code in the script, and it hasn't been changed at all. I'm thinking that this might be an error on PC-DMIS side of things, and not actually an error with the script.... only problem is idk what to do to fix it...

here is the script, if any one could double check this. original script was pulled from a post here, I think by

'Script for saving PC-DMIS reports by serial number in Work Order folder
'Will create folder for work order if none is present

'SETTINGS FOR USE
'Program should have 2 comments and ASSIGN variables created for the inputs of those comments as shown below
'C1         =COMMENT/INPUT,YES,FULL SCREEN=NO,
'            WORK ORDER
'C2         =COMMENT/INPUT,YES,FULL SCREEN=NO,
'            SERIAL NUMBER
'            ASSIGN/WO=C1.INPUT
'            ASSIGN/SN=C2.INPUT

'At the end of program create another ASSIGN variable labeled REPORT_PATH and its value should be the file location you want reports in, minus the work order folder
'and with the "+WO+" variable at the end
'Example of assignment - ASSIGN/REPORT_PATH="F:\QUALITY\CMM\CMM inspection reports\BOEING\314A6128-21\\"+WO+"

'After this line enable the script to run in the program, and mark script code lines

'Now ASSIGN variable labled VAR_FILENAME and its value should have the same path as above but with the addition of SN variable and .PDF to enable the report to save
'Example of this assignment - ASSIGN/VAR_FILENAME="F:\QUALITY\CMM\CMM inspection reports\BOEING\314A6128-21\\"+WO+"\\"+SN+".PDF"

'After this, in the edit window, hit ENTER then type "PRINT" then hit TAB, and place cursor in the new code and hit F9, click the report output checkbox
'And in the text box below type VAR_FILENAME
'Then click the "Overwrite" option, "PDF" option, and select any other options you see fit

'Auto archive of reports is now set up and ready to run

'Notes for use written by ANDY SMITH, script pulled from PC-DMIS Forum, and edited for use by ANDY SMITH, original script by DaVe_M

Sub Main()

Dim objFSO, objShell
Dim PCDApp, PCDPartProgram, PCDCommands, PCDCommand, retval
Dim objFile, objFolder As Object

Set PCDApp=CreateObject("PCDLRN.Application")
Set PCDPartProgram=PCDApp.ActivePartProgram
Set PCDCommands=PCDPartProgram.Commands

Set Pathname=PCDPartProgram.GetVariableValue("REPORT_PATH")

strPath=Pathname.StringValue

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists(strPath) Then
  'Nothing
Else
  Set objFile=objFSO.CreateFolder(strPath)
End If

End Sub​

Attached Files
Parents
  • Debug your script when the error happens, look at the strPath value to see what it is. You can display it in a messagebox for clarity.
    I would add it to the script so it displays every time you run it, that way - if the error is intermittent - you'll always display the variable value making it easier for you to debug.
Reply
  • Debug your script when the error happens, look at the strPath value to see what it is. You can display it in a messagebox for clarity.
    I would add it to the script so it displays every time you run it, that way - if the error is intermittent - you'll always display the variable value making it easier for you to debug.
Children