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
  • good day,

    for this short script, the error can actually only be at this point
    Set Pathname=PCDPartProgram.GetVariableValue("REPORT_P ATH")


    please check:
    * Variable "REPORT_PATH" exists in pcDMIS
    * Variable "REPORT_PATH" spelled correctly in pcDMIs
    * variable-content is actually a path in pcDMIs
    * the path can be actually created (Windows permissions)

    i think:
    * "objFSO.CreateFolder(strPath)" can only create the last folder, if several folders are to be created then there is an error message here.​



    strange: double backslash shouldn't actually work ^^
    please double check that the specified path is correct.
    Create the folders by hand and look at the path in windows and compare it with the script path
Reply
  • good day,

    for this short script, the error can actually only be at this point
    Set Pathname=PCDPartProgram.GetVariableValue("REPORT_P ATH")


    please check:
    * Variable "REPORT_PATH" exists in pcDMIS
    * Variable "REPORT_PATH" spelled correctly in pcDMIs
    * variable-content is actually a path in pcDMIs
    * the path can be actually created (Windows permissions)

    i think:
    * "objFSO.CreateFolder(strPath)" can only create the last folder, if several folders are to be created then there is an error message here.​



    strange: double backslash shouldn't actually work ^^
    please double check that the specified path is correct.
    Create the folders by hand and look at the path in windows and compare it with the script path
Children
  • Thanks for the input. Yeah, I have checked all my variables for consistency and spelling, and everything looked right. for some reason it seems to be only happening on one specific program, and sometimes it will work and sometimes it doesn't. So far, so good today though.

    And upon research when I first came up with this method, per the PC-DMIS help files, the double backslash is needed to end the folder location, and then to be able to use the "WO" variable.