ReaImDown Posted January 31, 2008 Share Posted January 31, 2008 (edited) basically, I want it to either show !@#$%^&*() or 1234567890, but I am not lucky enough to get either result... what am I doing wrong? hints are welcomed $Chr = StringSplit("30|29,31|28,32|2A,33|26,34|5E,35|25,36|24,37|23,38|40,39|21",",") dim $Chr1 For $i = 1 to $chr[0] $Chr1 = StringSplit($Chr[$i],"|") ; MsgBox(0,"",$chr1[2]) Next for $i = 1 to $Chr1[0] MsgBox(0,"",$Chr1[1] & " = " & _HexToString($chr1[1])) Next Edited January 31, 2008 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
picaxe Posted January 31, 2008 Share Posted January 31, 2008 Why not use a 2d array ?. Anyway try this, modifying your script #include <string.au3> $Chr = StringSplit("30|29,31|28,32|2A,33|26,34|5E,35|25,36|24,37|23,38|40,39|21",",") Dim $chr1[$chr[0] +1] $chr1[0] = $chr[0] For $i = 1 to $chr[0] $a = StringSplit($Chr[$i],"|") $chr1[$i] = $a[2] Next $s = "" for $i = $Chr1[0] To 1 Step -1 $s &= _HexToString($chr1[$i]) Next MsgBox(0, "", $s) Link to comment Share on other sites More sharing options...
ReaImDown Posted January 31, 2008 Author Share Posted January 31, 2008 (edited) Why not use a 2d array ?. Anyway try this, modifying your script #include <string.au3> $Chr = StringSplit("30|29,31|28,32|2A,33|26,34|5E,35|25,36|24,37|23,38|40,39|21",",") Dim $chr1[$chr[0] +1] $chr1[0] = $chr[0] For $i = 1 to $chr[0] $a = StringSplit($Chr[$i],"|") $chr1[$i] = $a[2] Next $s = "" for $i = $Chr1[0] To 1 Step -1 $s &= _HexToString($chr1[$i]) Next MsgBox(0, "", $s) nice work, thanks for your time...and sorry, I screwed up in my post... I meant msgbox(0,"","1") msgbox(0,"","2") msgbox(0,"","3") msgbox(0,"","4") msgbox(0,"","5") ....to 0 msgbox(0,"","!") msgbox(0,"","@") msgbox(0,"","#") msgbox(0,"","$")...To ) I have never used a 2d array...would that be an easier way to go? I cant seem to find any examples. Edited January 31, 2008 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
picaxe Posted January 31, 2008 Share Posted January 31, 2008 Ok maybe this #include <string.au3> $Chr = StringSplit("30|29,31|28,32|2A,33|26,34|5E,35|25,36|24,37|23,38|40,39|21",",") Dim $chr1[$chr[0] +1] Dim $chr2[$chr[0] +1] $chr1[0] = $chr[0] $chr2[0] = $chr[0] For $i = 1 to $chr[0] $a = StringSplit($Chr[$i],"|") $chr2[$i] = $a[1] $chr1[$i] = $a[2] Next For $i = 1 To $Chr2[0] MsgBox(0, "", _HexToString($chr2[$i])) Next For $i = $Chr1[0] To 1 Step -1 MsgBox(0, "", _HexToString($chr1[$i])) Next Link to comment Share on other sites More sharing options...
ReaImDown Posted January 31, 2008 Author Share Posted January 31, 2008 Ok maybe this #include <string.au3> $Chr = StringSplit("30|29,31|28,32|2A,33|26,34|5E,35|25,36|24,37|23,38|40,39|21",",") Dim $chr1[$chr[0] +1] Dim $chr2[$chr[0] +1] $chr1[0] = $chr[0] $chr2[0] = $chr[0] For $i = 1 to $chr[0] $a = StringSplit($Chr[$i],"|") $chr2[$i] = $a[1] $chr1[$i] = $a[2] Next For $i = 1 To $Chr2[0] MsgBox(0, "", _HexToString($chr2[$i])) Next For $i = $Chr1[0] To 1 Step -1 MsgBox(0, "", _HexToString($chr1[$i])) Next Thank you very much...1 more Q...would a 2d array be simpler? I have never used one, is it a more efficient way of coding? [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
MHz Posted January 31, 2008 Share Posted January 31, 2008 I have never used a 2d array...would that be an easier way to go? I cant seem to find any examples.Look at the top of the forum page and you will see a link to the Wiki. Some good information exists there about Arrays.http://www.autoitscript.com/wiki/Arrays Link to comment Share on other sites More sharing options...
picaxe Posted January 31, 2008 Share Posted January 31, 2008 (edited) Here's a 2d array example. It may be more efficient, depending on the format of your data #include <string.au3> $sData = StringReplace("30|29,31|28,32|2A,33|26,34|5E,35|25,36|24,37|23,38|40,39|21", "|", ",") $Chr = StringSplit($sData, ",") Dim $Chr2[$Chr[0]/2][2] $j = 0 For $i = 1 To $Chr[0] Step 2 $Chr2[$j][0] = $Chr[$i] $Chr2[$j][1] = $Chr[$i +1] $j += 1 Next For $i = 0 To UBound($Chr2) -1 MsgBox(0, "", _HexToString($Chr2[$i][0])) Next For $i = UBound($Chr2) -1 To 0 Step -1 MsgBox(0, "", _HexToString($Chr2[$i][1])) Next Edited January 31, 2008 by picaxe 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