hexagon logo

Testing Operator input for special characters or wild cards

Anyone have an idea how to test and stop operators inputting \/:*?<>| in comments? If it contains those then it will comment back and tell them to try again? im trying to use an if_goto statements.

[C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
ENTER SERIAL NUMBER
ASSIGN/NEWSN=C1.INPUT
IF_GOTO/NEWSN=="/" ,GOTO = DEATH
IF_GOTO/NEWSN==":" ,GOTO = DEATH
IF_GOTO/NEWSN=="*" ,GOTO = DEATH
IF_GOTO/NEWSN=="?" ,GOTO = DEATH
IF_GOTO/NEWSN=="<" ,GOTO = DEATH
IF_GOTO/NEWSN==">" ,GOTO = DEATH
IF_GOTO/NEWSN=="|" ,GOTO = DEATH
IF_GOTO/NEWSN=="0" ,GOTO = DEATH
GOTO/LIVE
DEATH =LABEL/
IF/1
COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=YES,TIME DELAY=10,
DO NOT USE SPECIAL CHARACTERS FOR THE INPUT.
TRY AGAIN!
GOTO/C1
END_IF/
LIVE =LABEL/​]
Parents
  • I think has the best solution here imo.
    What I used to for my programs is condense everything into a couple lines using OR.

    REDO =Label
    ​​​​​If/ELEMENT(1,"/",C1.INPUT)<>C1.INPUT OR ELEMENT(1,"*",C1.INPUT)<>C1.INPUT OR ELEMENT(1,"?",C1.INPUT)<>C1.INPUT OR...

    And so on all in one line..

    Comment/OPER TRY AGAIN WITH NO SPECIAL CHARACTERS!!
    GOTO/REDO
    End_If/

    Continue on..

    That's how I used to do it. Now I have a custom form that opens at the beginning of each program asking to fill out all info on one form. A script runs on the input sections so if a special character is used, it won't even let them enter it or continue without filling out all of the info properly. All of that info saves to a text file and the program will pull that info from the text file and populate in the form no matter what CMM is used. Handier than filling out multiple comment boxes.

Reply
  • I think has the best solution here imo.
    What I used to for my programs is condense everything into a couple lines using OR.

    REDO =Label
    ​​​​​If/ELEMENT(1,"/",C1.INPUT)<>C1.INPUT OR ELEMENT(1,"*",C1.INPUT)<>C1.INPUT OR ELEMENT(1,"?",C1.INPUT)<>C1.INPUT OR...

    And so on all in one line..

    Comment/OPER TRY AGAIN WITH NO SPECIAL CHARACTERS!!
    GOTO/REDO
    End_If/

    Continue on..

    That's how I used to do it. Now I have a custom form that opens at the beginning of each program asking to fill out all info on one form. A script runs on the input sections so if a special character is used, it won't even let them enter it or continue without filling out all of the info properly. All of that info saves to a text file and the program will pull that info from the text file and populate in the form no matter what CMM is used. Handier than filling out multiple comment boxes.

Children
No Data