My GUI and program work but just not as expected, so hear me out.
I wrote this program to take user input in the form of 1-10 example words for 3 categories.
The purpose of it is to output a text file with every triad permutation.
Unfortunately it is outputting permutations that aren’t triads.
It isn’t very much code, why is this happening?
ex.
GUI:
Colors Numbers Greek-letters
Red One Alpha
Blue Two Beta
output:
red one alpha
red one beta
red two alpha
red two beta
blue one alpha
blue one beta
blue two alpha
blue two beta
////////////////////////////////////////////////////////////////////////////////////
#include <GUIConstantsEx.au3>
$windowWidth = 600
$windowHeight = 430
$textFieldVertSpacing = 30
GUICreate("Semantic Intuition/Idea Naming Tool", $windowWidth, $windowHeight)
GUISetBkColor (0xB0E2FF)
GUICtrlCreateLabel("Category A", 80, 10)
GUICtrlCreateLabel("Category B", 260, 10)
GUICtrlCreateLabel("Category C", 450, 10)
$categoryA = GUICtrlCreateInput("", (150*0)+(150/4)*1, 40, 150)
$categoryB = GUICtrlCreateInput("", (150*1)+(150/4)*2, 40)
$categoryC = GUICtrlCreateInput("", (150*2)+(150/4)*3, 40)
$example0 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80)
$example1 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*1)
$example2 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*2)
$example3 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*3)
$example4 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*4)
$example5 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*5)
$example6 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*6)
$example7 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*7)
$example8 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*8)
$example9 = GUICtrlCreateInput("", (150*0)+(150/4)*1, 80+$textFieldVertSpacing*9)
$example10 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80)
$example11 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*1)
$example12 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*2)
$example13 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*3)
$example14 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*4)
$example15 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*5)
$example16 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*6)
$example17 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*7)
$example18 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*8)
$example19 = GUICtrlCreateInput("", (150*1)+(150/4)*2, 80+$textFieldVertSpacing*9)
$example20 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80)
$example21 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*1)
$example22 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*2)
$example23 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*3)
$example24 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*4)
$example25 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*5)
$example26 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*6)
$example27 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*7)
$example28 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*8)
$example29 = GUICtrlCreateInput("", (150*2)+(150/4)*3, 80+$textFieldVertSpacing*9)
$generateTriadButton = GUICtrlCreateButton("Generate", ($windowWidth-100)/2, $windowHeight-40, 100)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Global $examplesA[10] = [$example0, $example1, $example2, $example3, $example4, $example5, $example6, $example7, $example8, $example9]
Global $examplesB[10] = [$example10, $example11, $example12, $example13, $example14, $example15, $example16, $example17, $example18, $example19]
Global $examplesC[10] = [$example20, $example21, $example22, $example22, $example24, $example25, $example26, $example27, $example28, $example29]
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $generateTriadButton
permutate()
Exit
EndSwitch
WEnd
Func permutate()
$a = 0
$b = 0
$c = 0
$x = 1
$empty = ""
$output = FileOpen(@ScriptDir & "\TriadOutput.txt", 2)
While $a < 10
while $b < 10
while $c < 10
;MsgBox(0, "String length is:", StringLen($examplesA[$a]))
If (StringStripWS(GUICtrlRead($examplesA[$a]), 8) <> "") AND (StringStripWS(GUICtrlRead($examplesB[$b]), 8) <> "") AND (StringStripWS(GUICtrlRead($examplesA[$a]), 8) <> "") Then
FileWrite($output, $x)
FileWrite($output, ")")
FileWrite($output, " ")
FileWrite($output, GUICtrlRead($examplesA[$a]))
FileWrite($output, " ")
FileWrite($output, GUICtrlRead($examplesB[$b]))
FileWrite($output, " ")
FileWrite($output, GUICtrlRead($examplesC[$c]))
FileWrite($output, " ")
FileWrite($output, @CRLF)
$x = $x + 1
EndIf
$c = $c + 1
WEnd
$c = 0
$b = $b + 1
WEnd
$b = 0
$a = $a + 1
WEnd
FileClose($output)
EndFunc
Typical Copy-Paste-Error.
Just replace the second $a in your last If-Statement (line 94) with $c and it works as expected…
You find this out by verifying the output. The problem is, that every third text field is taken into account but the other two words work just fine. So the error must be in the expression (condition) responsible for the third field. And this is just in line 94…