hexagon logo

Partprograms.open scripting error

Ok so I have stolen some code from here on using a script to open a program and run it, then closes the program. It runs and works perfectly... UNTIL I try to make the filepath variable, such as ("C:\Users\Public\Desktop" + strID ) so that I can use a barcode scanner to input the last bit of filepath into the script and execute that way. I keep getting an error message on the PCDpartprogams.open line stating "wrong number of dimensions". Any ideas?


Found this in my repository...


Dim PCDApp, PCDPartPrograms, PCDPartProgram

Set PCDApp = CreateObject("PCDLRN.Application")
Set PCDPartPrograms = PCDApp.PartPrograms

PCDApp.Visible = True
PCDPartPrograms.Open "Z:\test1.PRG", "CMM1"

Set PCDPartProgram = PCDApp.ActivePartProgram

'msgbox "This will start the execution of the partprogram!"
PCDPartProgram.Execute

' PC-DMIS executes the partprogram

PCDPartProgram.Close

' PC-DMIS closes and saves the partprogram

PCDPartPrograms.Open "Z:\test2.PRG", "CMM1"

Set PCDPartProgram = PCDApp.ActivePartProgram

'msgbox "This will start the execution of the partprogram!"
PCDPartProgram.Execute

' PC-DMIS executes the partprogram

PCDPartProgram.Close

' PC-DMIS closes and saves the partprogram

' Cleanup
Set PCDPartProgram = nothing
Set PCDPartPrograms = nothing
Set PCDApp = nothing




This should (in theory) open "test1.prg", execute it, close and save and then open "test2.prg", execute it, close and save.
Parents
  • just a question how are you executing the script? If inside pcdmis the first PRG loaded will be connected to the machine by default (assuming you are online). All others will be offline. Nt sure if this matters or not as I don't run many scripts.

    Maybe attach some the code making the script call?
    PCDMIS version?
Reply
  • just a question how are you executing the script? If inside pcdmis the first PRG loaded will be connected to the machine by default (assuming you are online). All others will be offline. Nt sure if this matters or not as I don't run many scripts.

    Maybe attach some the code making the script call?
    PCDMIS version?
Children
No Data