Task: Changing the Default Radio Button based on previous runs selection
Program Code:
INPUT =LABEL/ ASSIGN/OPERATOR="XXX - Place Holder" ASSIGN/JOB="XXXXX" ASSIGN/SAMP="" ASSIGN/SHIFT="3rd" ASSIGN/FIXTURE="NO" ASSIGN/PROBE="NO" ASSIGN/PROG="NO" ASSIGN/CAL="NO" ASSIGN/MACHINE="" Operator_Input=SCRIPT/FILENAME= C:\PC-DMIS\4_3\BASIC SCRIPTS\BASIC INPUT.BAS FUNCTION/Main,SHOW=NO,, STARTSCRIPT/
Basic Script Section:
'-------- 'This sets the later used value as a string Dim Shift As String '-------- 'This sets the previous used value from the variable in the program Set ShiftCheck = PCDPartProgram.GetVariableValue ("SHIFT") '-------- 'This sets the String value to a value Shifty = ShiftCheck.StringValue '-------- 'This controls the specific Radio Button Value based on the pulled Value Select Case Shifty Case "" Check = -1 'Clears the Radio Button Selections Case "1st" Check = 0 'First Radio Button in Group Case "2nd" Check = 1 'Second Radio Button in Group Case "3rd" Check = 2 'Third Radio Button in Group End Select '-------- 'This is the section used in the Dialogue for the Button 'Box & Buttons & Text For Shift Selection GroupBox 5,55,130,25 Text 10,65,25,12, "Shift # :" OptionGroup .grp1 OptionButton 40,64,22,12, "1st", .option1 OptionButton 65,64,22,12, "2nd", .option2 OptionButton 90,64,22,12, "3rd", .option3 '-------- 'This is the call out at the end of the Dialogue to control the Radio Button Group Value Dialg.grp1 = Check '-------- 'Section to control the Radio Button Selected for this execution 'Controls shift Selection Select Case Dialg.grp1 Case 0 Shift = ("1st") Case 1 Shift = ("2nd") Case 2 Shift = ("3rd") End Select '-------- 'Command to place the new selection into the program If Cmd.GetText(DEST_EXPR,0) = "SHIFT" Then bln = Cmd.PutText("""" + Shift + """", SRC_EXPR, 0) Cmd.ReDraw End If
That is each basic step. If it needs to be broke down more say something and I will help out.