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?
  • 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.
  • You guys have no idea how much you help me. I really appreciate all of you putting up with a noob like me.

    I'll give your suggestion a try. Report back when I have something...

    Think I'm getting the $@#! out of here. The ice is starting to fall...too many morons on the roads.

    You guys be safe.
  • Think I'm getting the $@#! out of here. The ice is starting to fall...too many morons on the roads.

    You guys be safe.


    Haha! The reason I have so much time on my hands today is .25" ice. I'm at home - not going anywhere. They're not equipped to treat the roads properly around here.
  • You must be in the southeast like me...

    They're not equipped to treat the roads properly around here.
  • You must be in the southeast like me...


    Dallas / Ft Worth area. I guess that statement applies anywhere south of the mason-dixon line. Slight smile

    Sent from my SPH-L710 using Tapatalk
  • Denton here!

    I've got a spread of two laptops and an extra monitor set up on my kitchen table, working over VPN for the day. Way better than being in the office! Slight smile
  • Nice and toasty 55 degrees in Connecticut today. I suppose we'll get our fair share of the crappy weather, soon enough. Can't wait for the first snowfall, in which all New England drivers panic and forget for a moment what snow is and how to drive on it.
  • Nice and toasty 55 degrees in Connecticut today. I suppose we'll get our fair share of the crappy weather, soon enough. Can't wait for the first snowfall, in which all New England drivers panic and forget for a moment what snow is and how to drive on it.


    We've got a nice coating of ice over everything (2" thick solid ice in my driveway!) Unfortunately, people here seem to think it's snow, and that they also somehow know how to drive in snow...
  • Denton here!

    I've got a spread of two laptops and an extra monitor set up on my kitchen table, working over VPN for the day. Way better than being in the office! Slight smile


    I'm in Plano - you got it worse than we did! At least we've both got power (apparently).

    You're showing more dedication than me - I'm looking at this as a long weekend! Slight smile
  • I'm in Plano - you got it worse than we did! At least we've both got power (apparently).

    You're showing more dedication than me - I'm looking at this as a long weekend! Slight smile


    We have corporate flying in next week and I have to get some presentations ready before-hand, otherwise I would probably still be in bed.