pixartist Posted December 26, 2007 Share Posted December 26, 2007 (edited) expandcollapse popupdim $a[25] = [18, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z"] dim $b[25] = [6, "a", "e", "i", "o", "u", "r"] dim $c[25] = [7, "h", "a", "e", "i", "o", "u", "k"] dim $d[25] = [6, "a", "e", "i", "o", "u", "r"] dim $e[25] = [19, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z", "i"] dim $f[25] = [7, "a", "e", "i", "o", "u", "r", "l"] dim $g[25] = [7, "a", "e", "i", "o", "u", "r", "l"] dim $h[25] = [5, "a", "e", "i", "o", "u"] dim $i[25] = [18, "b", "c", "d", "f", "g", "h", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z"] dim $j[25] = [5, "a", "e", "i", "o", "u"] dim $k[25] = [7, "a", "e", "i", "o", "u", "r", "l"] dim $l[25] = [7, "a", "e", "i", "o", "u", "r", "l"] dim $m[25] = [6, "a", "e", "i", "o", "u", "j"] dim $n[25] = [6, "a", "e", "i", "o", "u", "j"] dim $o[25] = [20, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z", "o", "u"] dim $p[25] = [8, "a", "e", "i", "o", "u", "r", "l","h"] dim $q[25] = [1, "u"] dim $r[25] = [5, "a", "e", "i", "o", "u"] dim $s[25] = [7, "ch", "k", "l", "m", "p", "t", "h"] dim $t[25] = [6, "a", "e", "i", "o", "u", "r"] dim $u[25] = [18, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z"] dim $v[25] = [5, "a", "e", "i", "o", "u"] dim $w[25] = [6, "a", "e", "i", "o", "u", "r"] dim $x[25] = [6, "a", "e", "i", "o", "u", "y"] dim $y[25] = [18, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z"] dim $z[25] = [5, "a", "e", "i", "o", "u"] Dim $results[26] $results[0] = $a $results[1] = $b $results[2] = $c $results[3] = $d $results[4] = $e $results[5] = $f $results[6] = $g $results[7] = $h $results[8] = $i $results[9] = $j $results[10] = $k $results[11] = $l $results[12] = $m $results[13] = $n $results[14] = $o $results[15] = $p $results[16] = $q $results[17] = $r $results[18] = $s $results[19] = $t $results[20] = $u $results[21] = $v $results[22] = $w $results[23] = $x $results[24] = $y $results[25] = $z $b = _ArraySearch($letters, $prev)-1 Return $results[$b][Random(1, $results[$b][0])]oÝ÷ Ûrv zÚ®¢× Edited December 26, 2007 by pixartist Link to comment Share on other sites More sharing options...
pixartist Posted December 26, 2007 Author Share Posted December 26, 2007 it's so funny if IsArray($results[0]) Then MsgBox(0,"","wtf?") MsgBox(0,"",$results[0][0]) EndIf will show me "wtf?" and then crash ?! Link to comment Share on other sites More sharing options...
martin Posted December 26, 2007 Share Posted December 26, 2007 expandcollapse popupdim $a[25] = [18, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z"] dim $b[25] = [6, "a", "e", "i", "o", "u", "r"] dim $c[25] = [7, "h", "a", "e", "i", "o", "u", "k"] dim $d[25] = [6, "a", "e", "i", "o", "u", "r"] dim $e[25] = [19, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z", "i"] dim $f[25] = [7, "a", "e", "i", "o", "u", "r", "l"] dim $g[25] = [7, "a", "e", "i", "o", "u", "r", "l"] dim $h[25] = [5, "a", "e", "i", "o", "u"] dim $i[25] = [18, "b", "c", "d", "f", "g", "h", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z"] dim $j[25] = [5, "a", "e", "i", "o", "u"] dim $k[25] = [7, "a", "e", "i", "o", "u", "r", "l"] dim $l[25] = [7, "a", "e", "i", "o", "u", "r", "l"] dim $m[25] = [6, "a", "e", "i", "o", "u", "j"] dim $n[25] = [6, "a", "e", "i", "o", "u", "j"] dim $o[25] = [20, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z", "o", "u"] dim $p[25] = [8, "a", "e", "i", "o", "u", "r", "l","h"] dim $q[25] = [1, "u"] dim $r[25] = [5, "a", "e", "i", "o", "u"] dim $s[25] = [7, "ch", "k", "l", "m", "p", "t", "h"] dim $t[25] = [6, "a", "e", "i", "o", "u", "r"] dim $u[25] = [18, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z"] dim $v[25] = [5, "a", "e", "i", "o", "u"] dim $w[25] = [6, "a", "e", "i", "o", "u", "r"] dim $x[25] = [6, "a", "e", "i", "o", "u", "y"] dim $y[25] = [18, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z"] dim $z[25] = [5, "a", "e", "i", "o", "u"] Dim $results[26] $results[0] = $a $results[1] = $b $results[2] = $c $results[3] = $d $results[4] = $e $results[5] = $f $results[6] = $g $results[7] = $h $results[8] = $i $results[9] = $j $results[10] = $k $results[11] = $l $results[12] = $m $results[13] = $n $results[14] = $o $results[15] = $p $results[16] = $q $results[17] = $r $results[18] = $s $results[19] = $t $results[20] = $u $results[21] = $v $results[22] = $w $results[23] = $x $results[24] = $y $results[25] = $z $b = _ArraySearch($letters, $prev)-1 Return $results[$b][Random(1, $results[$b][0])]oÝ÷ Ûrv zÚ®¢× The line beginning Return $results[... is using $results as a 2-dimensional array, but you declared it to have 1 dimension. So there is an error. The second block of code you gave you said doesn't work, but can you say what you want to happen, and what doesn't work. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
randallc Posted December 26, 2007 Share Posted December 26, 2007 (edited) Hi, This is the perennial problem of people used to jscript type arrays instead of vbscript type arrays; it is expected that the 1D"Array of Arrays" will automatically be declared as a 2D array system. There is a lot written here about workarounds, but best to earn how vbscript and AutoIt do 2D arrays from the helpfile. Best, Randall Edited December 26, 2007 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
randallc Posted December 26, 2007 Share Posted December 26, 2007 (edited) Hi, cf above; ; ArrayjscriptType.au3 #include<array.au3> Local $a[25] = [18, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z" ] Local $b[25] = [6, "a", "e", "i", "o", "u", "r" ] Local $c[25] = [7, "h", "a", "e", "i", "o", "u", "k" ] Local $d[25] = [6, "a", "e", "i", "o", "u", "r" ] Local $results[4] = [$a, $b, $c, $d]; ie Array of 1D Arrays _ArrayDisplay($d) _ArrayDisplay($results[0]) ; Method1 Local $arResults2D[UBound($results) ][25] = [ _ [18, "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "x", "z" ], _ [6, "a", "e", "i", "o", "u", "r" ], _ [7, "h", "a", "e", "i", "o", "u", "k" ], _ [6, "a", "e", "i", "o", "u", "r" ] _ ] ; note there is a single line limit of 4096, I think, for Autoit script lines _ArrayDisplay($arResults2D,"Method1 $arResults2D[3][6];="&$arResults2D[3][6]) ; Method2 Local $ar2Results2D[UBound($results) ][25] For $row = 0 To UBound($results) - 1 For $col = 0 To 25 - 1 Local $arTemp = $results[$row]; ie Array of 1D Arrays requires temp Array to return values in AutoIt, vbscript $ar2Results2D[$row][$col] = $arTemp[$col] Next Next _ArrayDisplay($ar2Results2D,"Method2") ConsoleWrite("$ar2Results2D[1][Random(1, $ar2Results2D[1][0]-1)]="&$ar2Results2D[1][Random(1, $ar2Results2D[1][0]-1)]&@LF)I think _ArraySearch" only works for strings and numbers, but not sure. You may need to look at "Eval", "Assign", or hash funcs in forum search, too if you want to emulate jscript functionality and Array naming. [The Helpfile suggests -not- using embedded arrays in AutoIt due to speed issues, so 2D may be better if you can get around it here..] Hope that helps, Best, Randall Edited December 26, 2007 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
randallc Posted December 27, 2007 Share Posted December 27, 2007 (edited) Hi,PS, check some of these links too ..Forum FAQ about arraysExtra Help!A function to determine variable typeShows Exec calling answer from sub-arrays [Edit; or not... what do you think?]Best, Randall Edited December 28, 2007 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now