I am creating a GUI to collect information that will be used by code I plan to write in the future. The goal of this loop is to detect if the user has inputted any duplicate tool numbers into the GUI.
In this loop, the variable Tool_Counter contains a value of 1 for the first iteration of the loop, but, in all following iterations, the variable is set to null. I have arrived at this conclusion by inserting message boxes into the code to return the value of the variable Tool_Counter.
Code: Select all
Tool_Number:= 1
loop
{
Tool_Number:= %Tool_Number%+1
Tool_Counter:= 0
Loop
{
While (Tool_Counter < 16)
{
Tool_Counter:= %Tool_Counter%+1
If ( Tool_Number = Tool_Counter)
{
continue
}
Else
{
Place_Holder_Tool:= % Tool_Input_%Tool_Number%
Place_Holder_Counter:= % Tool_Input_%Tool_Counter%
If ( %Place_Holder_Tool% = %Place_Holder_Counter% )
{
msgbox Duplicate Tool Detected
}
Else
{
continue
}
}
}
break
}
If (Tool_Number = 15)
{
break
}
else
{
continue
}
}
Code: Select all
#SingleInstance, force
gui, show, x1600 y100 w600 h650,
gui, +alwaysontop
gui, add, text, section, Select Machine:
gui, add, DropDownList, gMachine vMachine Choose%Machine_Definition%, Ganesh|Haas
gui, add, text, w140 vText1,
gui, add, edit, Uppercase vProgram_Name
gui, add, text,, Part Name && Number
gui, add, edit, Uppercase vPart_Name
gui, add, text,, Stock Diameter
gui, add, edit, vStock_Diameter
gui, add, text,, Stock Material
gui, add, combobox, vStock_Material, |6061 Al|7075 Al|12L14|1018|1045|4140|303 SS|306 SS|316 SS|Tool Steel|
gui, add, text,, Part Stick Out
gui, add, edit, vPart_Stick_Out
gui, add, text,, Default Spindle Limit
gui, add, edit, vDefault_Spindle_Limit
gui, add, text,, Turning SFM
gui, add, edit, VSFM
gui, add, text,, Coolant Options
gui, add, DropDownList, vCoolant,
gui, add, text,, Lathe Tool Tips:
gui, add, text, section ys, Tool Number:
gui, add, text, ys w120, Tool Description:
gui, add, text, ys x+85, Tool Radius:
gui, add, text, ys, Tool Tip:
gui, add, edit, section xs w60 Number vTool_Input_1
gui, add, edit, ys w200 Uppercase vTool_Description_1
gui, add, edit, ys w60 vTool_Radius_1
gui, add, edit, ys Number W50 vTool_Tip_1
gui, add, edit, section xs w60 Number vTool_Input_2
gui, add, edit, ys w200 Uppercase vTool_Description_2
gui, add, edit, ys w60 vTool_Radius_2
gui, add, edit, ys Number W50 vTool_Tip_2
gui, add, edit, section xs w60 Number vTool_Input_3
gui, add, edit, ys w200 Uppercase vTool_Description_3
gui, add, edit, ys w60 vTool_Radius_3
gui, add, edit, ys Number W50 vTool_Tip_3
gui, add, edit, section xs w60 Number vTool_Input_4
gui, add, edit, ys w200 Uppercase vTool_Description_4
gui, add, edit, ys w60 vTool_Radius_4
gui, add, edit, ys Number W50 vTool_Tip_4
gui, add, edit, section xs w60 Number vTool_Input_5
gui, add, edit, ys w200 Uppercase vTool_Description_5
gui, add, edit, ys w60 vTool_Radius_5
gui, add, edit, ys Number W50 vTool_Tip_5
gui, add, edit, section xs w60 Number vTool_Input_6
gui, add, edit, ys w200 Uppercase vTool_Description_6
gui, add, edit, ys w60 vTool_Radius_6
gui, add, edit, ys Number W50 vTool_Tip_6
gui, add, edit, section xs w60 Number vTool_Input_7
gui, add, edit, ys w200 Uppercase vTool_Description_7
gui, add, edit, ys w60 vTool_Radius_7
gui, add, edit, ys Number W50 vTool_Tip_7
gui, add, edit, section xs w60 Number vTool_Input_8
gui, add, edit, ys w200 Uppercase vTool_Description_8
gui, add, edit, ys w60 vTool_Radius_8
gui, add, edit, ys Number W50 vTool_Tip_8
gui, add, edit, section xs w60 Number vTool_Input_9
gui, add, edit, ys w200 Uppercase vTool_Description_9
gui, add, edit, ys w60 vTool_Radius_9
gui, add, edit, ys Number W50 vTool_Tip_9
gui, add, edit, section xs w60 Number vTool_Input_10
gui, add, edit, ys w200 Uppercase vTool_Description_10
gui, add, edit, ys w60 vTool_Radius_10
gui, add, edit, ys Number W50 vTool_Tip_10
gui, add, edit, section xs w60 Number vTool_Input_11
gui, add, edit, ys w200 Uppercase vTool_Description_11
gui, add, edit, ys w60 vTool_Radius_11
gui, add, edit, ys Number W50 vTool_Tip_11
gui, add, edit, section xs w60 Number vTool_Input_12
gui, add, edit, ys w200 Uppercase vTool_Description_12
gui, add, edit, ys w60 vTool_Radius_12
gui, add, edit, ys Number W50 vTool_Tip_12
gui, add, edit, section xs w60 Number vTool_Input_13
gui, add, edit, ys w200 Uppercase vTool_Description_13
gui, add, edit, ys w60 vTool_Radius_13
gui, add, edit, ys Number W50 vTool_Tip_13
gui, add, edit, section xs w60 Number vTool_Input_14
gui, add, edit, ys w200 Uppercase vTool_Description_14
gui, add, edit, ys w60 vTool_Radius_14
gui, add, edit, ys Number W50 vTool_Tip_14
gui, add, edit, section xs w60 Number vTool_Input_15
gui, add, edit, ys w200 Uppercase vTool_Description_15
gui, add, edit, ys w60 vTool_Radius_15
gui, add, edit, ys Number W50 vTool_Tip_15
gui, add, Picture, x10 y435 w300 h200, C:\Users\Selva\Desktop\Autohotkey\Scripts\tool_orientation.jpg
gui, add, button, x400 y435default gSubmit_Button, Submit
Machine:
Coolant_Ganesh = |Air|Coolant|Off
Coolant_Haas = |Coolant|Off
Gui, Submit, NoHide
If Machine = Ganesh
{
GuiControl, , Text1, Program Name
SubList:=Coolant_Ganesh
GuiControl,,Coolant, %SubList%
Machine_Definition:=1
}
If Machine = Haas
{
GuiControl, , Text1, Program Number
SubList:=Coolant_Haas
GuiControl,,Coolant, %SubList%
Machine_Definition:=1
}
return
Submit_Button:
{
Tool_Number:= 1
loop
{
Tool_Number:= %Tool_Number%+1
Tool_Counter:= 0
Loop
{
While (Tool_Counter < 16)
{
Tool_Counter:= %Tool_Counter%+1
If ( Tool_Number = Tool_Counter)
{
continue
}
Else
{
Place_Holder_Tool:= % Tool_Input_%Tool_Number%
Place_Holder_Counter:= % Tool_Input_%Tool_Counter%
If ( %Place_Holder_Tool% = %Place_Holder_Counter% )
{
msgbox Duplicate Tool Detected
}
Else
{
continue
}
}
}
break
}
If (Tool_Number = 15)
{
break
}
else
{
continue
}
}
Gui, Submit, Hide
return
}
^r::
ExitApp
^t::
Pause
Thank you