Your Products have been synced, click here to refresh
Sub Main ' THIS SECTION DECLARES THE VARIABLES For THE FILENAME SAVE And FOLDER CREATE ' "SET" DECLARES THE VALUE OF THE VARIABLES ' "PART.GETVARIABLEVALUE" PULLS THE VARIABLE VALUE FROM THE .PRG UPON EXECUTION Dim App As Object Set App = CreateObject("PCDLRN.Application") Dim Part As Object Set Part = App.ActivePartProgram 'Declares PartProg As the Active part program Dim PartProg As Object Set PartProg = App.ActivePartProgram Dim Cmds As Object Set Cmds = Part.Commands Dim VSERIAL As Object Set VSERIAL = PART.GETVARIABLEVALUE ("VSERIALNUMBER") Dim VDATE As Object Set VDATE = PART.GETVARIABLEVALUE ("VDATE") Dim VTIME As Object Set VTIME = PART.GETVARIABLEVALUE ("VTIME") Dim VPARTNUMBER As Object Set VPARTNUMBER = PART.GETVARIABLEVALUE ("VPART") Dim VDESCRIPTION As Object Set VDESCRIPTION = PART.GETVARIABLEVALUE ("VDESCRIPTION") End Sub
I guess that will work, but that co de needs assignments in your partprogram before it can do anything else (VSERIALNUMBER, VDATE, VTIME, VDESCRIPTION).
Dim FILENAME, FILEPATH, FOLDER As string
Sub Main ' THIS SECTION DECLARES THE VARIABLES For THE FILENAME SAVE And FOLDER CREATE ' "SET" DECLARES THE VALUE OF THE VARIABLES ' "PART.GETVARIABLEVALUE" PULLS THE VARIABLE VALUE FROM THE .PRG UPON EXECUTION Dim App As Object Set App = CreateObject("PCDLRN.Application") Dim PART As Object Set Part = App.ActivePartProgram 'Declares PartProg As the Active part program Set PartProg = App.ActivePartProgram Set Cmds = Part.Commands Set VSERIAL = PART.GETVARIABLEVALUE ("VSERIALNUMBER") Set VDATE = PART.GETVARIABLEVALUE ("VDATE") Set VTIME = PART.GETVARIABLEVALUE ("VTIME") Set VPARTNUMBER = PART.GETVARIABLEVALUE ("VPART") Set VDESCRIPTION = PART.GETVARIABLEVALUE ("VDESCRIPTION") Set RESULTS = RESULTS Set VPROGRAMID = PART.GETVARIABLEVALUE ("VPROGRAMID") 'Creates the file folder path Set FILENAME = CREATEOBJECT(VPART & "_" & VDESCRIPTION & "_" & VSERIALNUMBER & "_" & VDATE & "_" & VTIME) Set FILEPATH = CREATEOBJECT("D:\CMM_PROGRAMS\" & VPART & "_" & VDESCRIPTION & "_" & VPROGRAMID & "\" & RESULTS & "\") Set FOLDER = CREATEOBJECT(FILEPATH & FILENAME) End Sub
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.
...or post the entire script you got so we can edit that directly.
Dim FILENAME, FILEPATH, FOLDER As String Dim App As Object Set App = CreateObject("PCDLRN.Application")
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.
FILENAME = VPART.StringValue & "_" & VDESCRIPTION.StringValue & "_" & VSERIALNUMBER.StringValue & "_" & VDATE.StringValue & "_" & VTIME.StringValue
So what command (syntax) actually creates the folder I want? CreateObject?
I would really recommend that you go to your local used bookstore and pick up a book on VBScript. No offense, but this question demonstrates a complete lack of understanding about what's going on.
I would really recommend that you go to your local used bookstore and pick up a book on VBScript.
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |