Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/12/2012 in all areas

  1. What part of my answer suggested to you that there might be a way of doing it?
    1 point
  2. Tomoya, This works for me: #include <GUIConstantsEx.au3> #include <GUIListView.au3> ; As you start reading the array from element 1 I have done the same Global $aArray[11] = [10, "Item 1", "SubItem 1", "Item 2", "SubItem 2", "Item 3", "SubItem 3", "Item 4", "SubItem 4", "Item 5", "SubItem 5"] Global $iIndex = -1 $hGUI = GUICreate("Test", 500, 500) $hListView = _GUICtrlListView_Create($hGUI, "", 10, 10, 280, 200) _GUICtrlListView_AddColumn($hListView, "Item", 140) _GUICtrlListView_AddColumn($hListView, "SubItem", 140) ; Loop throught he array For $n = 1 To UBound($aArray) - 1 ; Is it an odd number? If Mod($n, 2) Then ; Add the value and save the returned line index $iIndex = _GUICtrlListView_AddItem($hListView, $aArray[$n]) Else ; Use the saved line index to position the subitem _GUICtrlListView_AddSubItem($hListView, $iIndex, $aArray[$n], 1) EndIf Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd All clear? M23
    1 point
  3. Use the return value of _GUICtrlListView_AddItem as the $iIndex parameter of _GUICtrlListView_AddSubItem.
    1 point
  4. czardas

    Logic Question

    Lol beat me to it. Here goes anyway: Global $incoming_var = "?", $spot = "?" Global $a_Args[12][7] = _ [["1", "1", "11", $incoming_var, $spot, "1", "5"], _ ["1", "1", "11", $incoming_var, $spot, "1", "6"], _ ["1", "1", "11", $incoming_var, $spot, "1", "7"], _ ["1", "2", "10", $incoming_var, $spot, "1", "5"], _ ["1", "2", "10", $incoming_var, $spot, "1", "6"], _ ["1", "2", "10", $incoming_var, $spot, "1", "7"], _ ["2", "1", "11", $incoming_var, $spot, "1", "5"], _ ["2", "1", "11", $incoming_var, $spot, "1", "6"], _ ["2", "1", "12", $incoming_var, $spot, "1", "7"], _ ["2", "2", "11", $incoming_var, $spot, "1", "5"], _ ["2", "2", "11", $incoming_var, $spot, "1", "6"], _ ["2", "2", "11", $incoming_var, $spot, "1", "7"]] $iStart = Random(0, 11, 1) For $i = 0 To 11 $idx = Mod($i + $iStart, 11) tracker($a_Args[$idx][0], $a_Args[$idx][1], $a_Args[$idx][2], $a_Args[$idx][3], $a_Args[$idx][4], $a_Args[$idx][5], $a_Args[$idx][6]) Next Func tracker($flight, $a_or_b, $page_number, $URL, $URL_page, $customer_type, $spare) ConsoleWrite($flight & " " & $a_or_b & " " & $page_number & " " & $URL & " " & $URL_page & " " & $customer_type & " " & $spare & " " & @CRLF) EndFunc Why is my code wrapping? Edit Hopefully this edit will fix it. Nope it's not fixed it. You will have to click the Popup button to get the correct code. I am having issues posting in the code boxes. Actually I think it's IE on my computer.
    1 point
  5. kylomas

    Logic Question

    Iceberg, Try this global $incoming_var, $spot global $A_args[12][7]=[ _ ["1", "1", "11", $incoming_var, $spot, "1", "5"], _ ["1", "1", "11", $incoming_var, $spot, "1", "6"], _ ["1", "1", "11", $incoming_var, $spot, "1", "7"], _ ["1", "2", "10", $incoming_var, $spot, "1", "5"], _ ["1", "2", "10", $incoming_var, $spot, "1", "6"], _ ["1", "2", "10", $incoming_var, $spot, "1", "7"], _ ["2", "1", "11", $incoming_var, $spot, "1", "5"], _ ["2", "1", "11", $incoming_var, $spot, "1", "6"], _ ["2", "1", "12", $incoming_var, $spot, "1", "7"], _ ["2", "2", "11", $incoming_var, $spot, "1", "5"], _ ["2", "2", "11", $incoming_var, $spot, "1", "6"], _ ["2", "2", "11", $incoming_var, $spot, "1", "7"] _ ] $iStart = Random(0, 11, 1) For $i = 0 To 11 $iIndex = Mod($i + $iStart, 11) Call ("tracker", $A_args[$iIndex][0], $A_args[$iIndex][1], $A_args[$iIndex][2], $A_args[$iIndex][3], $A_args[$iIndex][4], $A_args[$iIndex][5], $A_args[$iIndex][6]) Next Func tracker($flight, $a_or_b, $page_number, $URL, $URL_page, $customer_type, $spare) ConsoleWrite($flight & ' ' & $a_or_b & ' ' & $page_number & ' ' & $URL & ' ' & $URL_page & ' ' & $customer_type & ' ' & $spare) EndFunc kylomas
    1 point
  6. kylomas

    Logic Question

    Iceberg, If you are trying to treat the array variable names dynamically, it might be done using eval and/or assign, not sure how though. kylomas
    1 point
  7. kylomas

    Logic Question

    Iceberg, Because you are referencing a one dimensional array as a two dimensional array. If you are going to one function you do not need all the logic for running multiple funcs. Change the definition of your arrays. You are declaring them as a 1D array and initializing them as a 2D array. I suggest you use one array as follows local $a_args[11][7] This creates one array of 11 lines, each line comprised of 7 columns. kylomas edit: my f$%^$#king keyboard is broke
    1 point
  8. kylomas

    Logic Question

    Iceberg, Or this wayto generate a random number of parms Global $aFuncs[5] =["Func_1", "Func_2", "Func_3", "Func_4", "Func_5"] While 1 $iStart = Random(0, 4, 1) For $i = 0 To ubound($aFuncs) - 1 $iIndex = Mod($i + $iStart, 5) local $aMyparms[20] for $j = 0 to random(0,ubound($aMyparms) - 1,1) $aMyparms[$j] = random(0,99,1) next Call($aFuncs[$iIndex], $aMyparms) $aMyparms = 0 Next ConsoleWrite(@CRLF) If MsgBox(4, "Finished", "Ready for another run?") = 7 Then ExitLoop EndIf WEnd Func Func_1($aVars) local $str for $i = 0 to ubound($aVars) - 1 $str &= stringformat('%-5s',$aVars[$i]) next ConsoleWrite("Func 1 called " & $str & @lf) EndFunc Func Func_2($aVars) local $str for $i = 0 to ubound($aVars) - 1 $str &= stringformat('%-5s',$aVars[$i]) next ConsoleWrite("Func 2 called " & $str & @lf) EndFunc Func Func_3($aVars) local $str for $i = 0 to ubound($aVars) - 1 $str &= stringformat('%-5s',$aVars[$i]) next ConsoleWrite("Func 3 called " & $str & @lf) EndFunc Func Func_4($aVars) local $str for $i = 0 to ubound($aVars) - 1 $str &= stringformat('%-5s',$aVars[$i]) next ConsoleWrite("Func 4 called " & $str & @lf) EndFunc kylomas
    1 point
×
×
  • Create New...