hexagon logo

Using script to create folder for prg and save part program

Been reading up on the script manual (PC-DMIS) 3.6 Basic Language Reference Manual) trying to figure out how to get the script to create a folder for the report, the .prg, and any other files associated with the program by serial number of the part.

For example:
PART#_DESCRIPTION_SERIAL#_DATE_TIME

The goal is to write a script contained in the .prg that, upon execution of the part program, will create a folder in a specified directory with the variable filename using the inputs from the part program and save the .prg with the same name.

How would I pass the information from the operator inputs of the part program into the script to make this happen?
Parents
  • Ah, didn't notice it in the code you posted. You are trying to create an object from a string concatenation.

    Try dim'ing the FILENAME, FILEPATH and FOLDER as strings instead.

    Add this to the beginning of your script:
    Dim FILENAME, FILEPATH, FOLDER As string


    Then just remove the "CREATEOBJECT( .. )" from the FILENAME, FILEPATH and FOLDER definitions.
    Leave the Set FILENAME = "D:........" as is for FILENAME, FOLDER and FILEPATH.


    Additionally, you'll have to access the properties of the Variable type objects to get the data. Like this:

    FILENAME = VPART.StringValue & "_" & VDESCRIPTION.StringValue & "_" & VSERIALNUMBER.StringValue & "_" & VDATE.StringValue & "_" & VTIME.StringValue
Reply
  • Ah, didn't notice it in the code you posted. You are trying to create an object from a string concatenation.

    Try dim'ing the FILENAME, FILEPATH and FOLDER as strings instead.

    Add this to the beginning of your script:
    Dim FILENAME, FILEPATH, FOLDER As string


    Then just remove the "CREATEOBJECT( .. )" from the FILENAME, FILEPATH and FOLDER definitions.
    Leave the Set FILENAME = "D:........" as is for FILENAME, FOLDER and FILEPATH.


    Additionally, you'll have to access the properties of the Variable type objects to get the data. Like this:

    FILENAME = VPART.StringValue & "_" & VDESCRIPTION.StringValue & "_" & VSERIALNUMBER.StringValue & "_" & VDATE.StringValue & "_" & VTIME.StringValue
Children
No Data