in the code below, the loop will end up flagging 2 Vars as MW or OS. the first loop should trigger the final action, but the second one returns a messagebox of "462518" which is NOT in my "alrobranches" array. this means it should not trigger a final message box, but it does. i am completely stumped.
Code: Select all
Vars := ["br1p1","br2p1","br3p1","br4p1","br5p1","br6p1","br7p1","br1p2","br2p2","br3p2","br4p2","br5p2","br6p2","br7p2","br1p3","br2p3","br3p3","br4p3","br5p3","br6p3","br7p3","br1p4","br2p4","br3p4","br4p4","br5p4","br6p4","br7p4","br1p5","br2p5","br3p5","br4p5","br5p5","br6p5","br7p5","br1p6","br2p6","br3p6","br4p6","br5p6","br6p6","br7p6","br1p7","br2p7","br3p7","br4p7","br5p7","br6p7","br7p7","br1p8","br2p8","br3p8","br4p8","br5p8","br6p8","br7p8","br1p9","br2p9","br3p9","br4p9","br5p9","br6p9","br7p9"]
TotalResultP := 0
Result := ""
MW_Flag := 0
OS_Flag := 0
Loop, % Vars.MaxIndex()
{
alrobranches := [891400,891700, 888071, 888078, 888200, 891300, 888800, 889210, 888020, 889110, 888770, 890300, 890100, 888024, 888009, 888076, 888104, 891505, 891500, 891200, 889201, 888030, 889790, 889153, 889100, 889800, 890200, 888000, 889600, 891600, 889121, 890800, 890600, 890400, 888301, 888600, 889750, 889744, 891710, 891650, 889725, 889027, 888008, 889610, 888702, 888015, 889620, 888072, 889780, 0]
VarName := Vars[A_Index]
VarValue := %VarName%
if (VarValue = "MW" or VarValue = "OS")
{
ResultP := VarName "p"
ResultVen := VarName "ven"
Result .= VarValue " has " %ResultP% "picks`n"
Result .= VarValue " Vendor is " %ResultVen% "`n"
varvar := %ResultP%
venven := %ResultVen%
; Add the value of ResultP to the running total
TotalResultP += %varvar%
77 := %resultven%
if (VarValue = "MW" && (77 in alrobranches))
{
MW_Flag := 1
msgbox, %77%
}
if (VarValue = "OS" && (77 in alrobranches))
{
OS_Flag := 1
msgbox, %77%
}
}
}
if (TotalResultP >= 15 && (MW_Flag=1 && (OS_Flag=1)))
{
Result .= "Total ResultP is " TotalResultP "`n"
msgbox, final action
}