hexagon logo

Error executing basic script!

This is the error message I get when I try to run a script in my programs.  No line reference, just this error.  I've tried with more than one script, but this is all I get.  The scripts will compile in the edit window, but they won't run.  I'm new to using scripts, but I can't get past square one.  Any ideas what the problem could be?

Parents
  • Can you share the error message in a snapshot? Or perhaps share the script if you can. If you execute it from the script editing window does it give a line reference error?

  • My company firewall won't let me post pics on this board apparently, so I'll explain as best I can.  When I try to execute it from the edit window nothing happens.  When I insert it as a line of code and CTRL+U it, I get the error, which is those words exactly, and the file path below that. 

    I created this program containing a for loop and nothing else.  When I run it, I get the error.  However, when I remove the for loop, I don't get the error message.  Is there a different way to do it?  It seems like there's nothing to cause a problem.

    Sub test2
    Dim PCDApp As Object
    Dim PCDPartProgram As Object
    Dim PCDCommands As Object
    Dim PCDCommand As Object

    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands = PCDPartProgram.Commands

    For Each PCDCommand In PCDCommands
    Next PCDCommand

    End Sub

     

  • Have you tried putting an Exit For at the end of the for loop?

    For Each cmd In PCDCommands
    
    If cmd.Type = 171 Then
    	
    	'do something
    	     
        End If
        Exit For
    
        Next cmd

Reply Children