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
  • None taken. I admittedly have no idea. That's why I'm trying to learn. You never learn anything until you ask...right?

    Exactly - certainly not your fault. Everybody needs to start somewhere. It's commendable that you want to learn.

    I was looking at vpt's script again. You can basically use it as-is. You goal would be to merely change these two lines from being operator input values to using the values you obtained from the variables in the part program.
    strDirectory = InputBox("Enter folder to save in: ", "Create folder")
    strFileName = InputBox("Enter filename to save as: ", "Enter filename")


    You can build your path and filename just as you are now and change these lines to:
    strDirectory = FILEPATH
    strFileName = FILENAME


    You will also have to re-arrange the existing code a bit so that it connects to pc-dmis and gets the variable values before working with the filesystem object.

    Aside from the re-arrange, the only modification I would make to vpt's code is to change this:
    For cnt = 1 To PCDCommands.Count

    to this:
    For cnt = PCDCommands.Count To 1 Step -1


    because the print command will always be near the end of the part program. It will run a bit faster on a large program.
Reply
  • None taken. I admittedly have no idea. That's why I'm trying to learn. You never learn anything until you ask...right?

    Exactly - certainly not your fault. Everybody needs to start somewhere. It's commendable that you want to learn.

    I was looking at vpt's script again. You can basically use it as-is. You goal would be to merely change these two lines from being operator input values to using the values you obtained from the variables in the part program.
    strDirectory = InputBox("Enter folder to save in: ", "Create folder")
    strFileName = InputBox("Enter filename to save as: ", "Enter filename")


    You can build your path and filename just as you are now and change these lines to:
    strDirectory = FILEPATH
    strFileName = FILENAME


    You will also have to re-arrange the existing code a bit so that it connects to pc-dmis and gets the variable values before working with the filesystem object.

    Aside from the re-arrange, the only modification I would make to vpt's code is to change this:
    For cnt = 1 To PCDCommands.Count

    to this:
    For cnt = PCDCommands.Count To 1 Step -1


    because the print command will always be near the end of the part program. It will run a bit faster on a large program.
Children
No Data