hexagon logo

Script Not Executing

Hi there,

I copied the below script from the manual and saved it as C:\ENTER_NUM_SCRIPT.BAS If I RUN it in the Basic Script Editor it works as expected.

Sub Main
  Dim Msg, X, Y
  X = InputBox("Enter a Number:")
  Y = Abs(X)
  Msg = "The number you entered is " & X
  Msg = Msg + ". The Absolute value of " & X & " is " & Y
  MsgBox Msg 'Display Message.
End Sub
But if I call it from within a part program with the below, the script does not appear to run at all but the report comment does get printed out.
CS1        =SCRIPT/FILENAME= C:\ENTER_NUM_SCRIPT.BAS
            FUNCTION/Main,SHOW=YES,,
            STARTSCRIPT/
            COMMENT/REPT," I GOT HERE PASSED THE SCRIPT"
This happens with any script I attempt to run from within a part program.. strangely it was working this morning. A PC restart does nothing. Does anyone have a suggestion? Is there a particular place from within a part program I have to call scripts from? Or a setting somewhere?? ...anything at all???

...really confused here Disappointed... michelle
  • You cannot run ANY script??? As in, create a new part program, make a new test script, insert it, and NOTHING?

    Just some little things to make sure of....Your scripts are still located where the paths say they are, the script call in PC-DMIS is marked, so it will execute......and I'm all out of ideas. Strange.
  • Agggg no, I got it now! I didn't even think about marking the script - stupid me.

    But which brings me to the next question - is there a setting somewhere that everything gets marked by default?
  • Are you running marked sets?

    There is a button on the toolbar to mark all. You can use this to make sure everything is marked after making edits.
  • That mishap has happened to me a couple of times as well. Just press F3 with the cursor at the script command and it will mark/unmark it.
  • mmm... anyone know if there is a setting such that by default all scripts are marked?

    I don't want my operator having to mark scripts.
  • How are you creating this code? Importing it, or writing the program totally in PC-DMIS? Clicking the mark all button while in the program, and saving it, will cure the problem forever. If you are generating the program from code, there are lines that denote whether the code is marked or unmarked. There is no general "Mark All" setting.
  • How are you creating this code?
    Importing generated DMIS code.

    there are lines that denote whether the code is marked or unmarked
    Chally please could you paste in a basic example?
  • Set PCDCommand = PCDCommands.Add (EXTERNAL_COMMAND, True)
      [COLOR="Red"]PCDCommand.Marked = True[/COLOR]
      retval = PCDCommand.SetToggleString (2, DISPLAY_TRACE, 0)
      retval = PCDCommand.PutText ("" & Path & " " & destfile & "", COMMAND_STRING, 0)
    
    PCDCommand.ReDraw


    A snippet from one of my creations... Note the command marked in red.
  • Ok, this probably does not apply to what you are doing at all, but this is what you see when you export a PC-DMIS program as basic. This is an Input comment:

    Set DmisCommand = DmisCommands.Add(SET_COMMENT, TRUE)
        [COLOR="Red"]DmisCommand.Marked = TRUE[/COLOR]
      ' Set Id  = WORKORDER
        retval = DmisCommand.PutText ("WORKORDER", ID, 0)
      ' Set Comment Type  = INPUT
        retval = DmisCommand.SetToggleString (3, COMMENT_TYPE, 0)
      ' Set Comment Item 1 = 'Enter the workorder #,
        retval = DmisCommand.PutText ("'Enter the workorder #,", COMMENT_FIELD, 1)
      ' Set Comment Item 2 = using a period instead of a slash.'
        retval = DmisCommand.PutText ("using a period instead of a slash.'", COMMENT_FIELD, 2)
      ' Set Report  = NO
        retval = DmisCommand.SetToggleString (1, OUTPUT_TYPE, 0)


    What you probably need to look for is a way to mark all dimensions through code before executing the program. Look in the Wilcox script repository and search this site. I know there is a script that does this. So, you'd import your program, run this script, THEN execute the program, and everything would be hunky-dory.