hexagon logo

Tracefields and Scripts

Anyone out there know how to retrieve a Tracefield Value from a part program in a script? Can't quite find the right command...
Parents
  • Hmm... Are you sure you have an identical script running OK?

    I assume you are running this as a PC-DMIS script, but you are throwing in a FileSystemObject (Visual Basic Scripting) so I am thinking that in order to use that from within PC-DMIS, you might need to to do some additional coding to expose the VBS objects through PC-DMIS basic.

    For testing, I used this snippet running as a script in PC-DMIS:
    Sub Main()
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFldr = objFSO.CreateFolder("C:\test")
    End Sub
    


    This threw an automation object error.
    Now, using the same script (slightly modified) and executed it as a VBS script:

    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFldr = objFSO.CreateFolder("C:\test")


    ...works just fine.

    So, I believe that in order to use "out-of-process" objects, you'd need to code them differently (look in the PC-DMIS basic helpfile), or code the script as a VBS-script and call that from within PC-DMIS.
Reply
  • Hmm... Are you sure you have an identical script running OK?

    I assume you are running this as a PC-DMIS script, but you are throwing in a FileSystemObject (Visual Basic Scripting) so I am thinking that in order to use that from within PC-DMIS, you might need to to do some additional coding to expose the VBS objects through PC-DMIS basic.

    For testing, I used this snippet running as a script in PC-DMIS:
    Sub Main()
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFldr = objFSO.CreateFolder("C:\test")
    End Sub
    


    This threw an automation object error.
    Now, using the same script (slightly modified) and executed it as a VBS script:

    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFldr = objFSO.CreateFolder("C:\test")


    ...works just fine.

    So, I believe that in order to use "out-of-process" objects, you'd need to code them differently (look in the PC-DMIS basic helpfile), or code the script as a VBS-script and call that from within PC-DMIS.
Children
No Data