hexagon logo

Scripting Help for auto Save-as

Trying to get going on some scripting and automation. Very new to this so any and all help most appreciated. The following code gives this error :

---------------------------
PC-DMIS Basic Scripting Engine
---------------------------
Error on line: 9 - OLE Automation object does not have a default value
---------------------------
OK
---------------------------

Can someone help me get this simple script running?

Sub Main ()
Dim App As Object
Dim Part As Object
Set App = CreateObject ("PCDLRN.Application")
Set Part = App.ActivePartProgram
Dim Serial As Object
Set Serial = Part.GetVariableValue("V1")
Dim NewName$
NewName = Part.Path & Part.PartName & "_" & Serial & ".PRG"
retval = Part.SaveAs(NewName)
' Cleanup
Set Part = Nothing
Set App = Nothing
End Sub


I believe this code was originally posted in a different (and probably much better) form by VPT.se. I'm trying to learn how to do this sort of thing by modifying it.

Thanks for any help.
Parents
  • The basic code in pcdmis is not the same as visual basic.
    You can use the basic editor in pcdmis to compile your script but not make an .exe.


    So it sounds like I would need to either find either a freeware, purpose built basic compiler or, more likely, find some commercial software to do this. The reason I ask about this is that one of our online seats is a "PRO" seat and I don't believe you can execute basic scripts with a "PRO" seat. The documentation says you need at least "CAD". I am pretty sure I can execute an external function with the "PRO" seat so I could still use something like this on that CMM if it was in the form of an .exe that I could call externally.
Reply
  • The basic code in pcdmis is not the same as visual basic.
    You can use the basic editor in pcdmis to compile your script but not make an .exe.


    So it sounds like I would need to either find either a freeware, purpose built basic compiler or, more likely, find some commercial software to do this. The reason I ask about this is that one of our online seats is a "PRO" seat and I don't believe you can execute basic scripts with a "PRO" seat. The documentation says you need at least "CAD". I am pretty sure I can execute an external function with the "PRO" seat so I could still use something like this on that CMM if it was in the form of an .exe that I could call externally.
Children
No Data