FinalVersion Posted February 12, 2010 Share Posted February 12, 2010 Lets say I have a text file with the entire alphabet equal to something. Example: a=0427 b=6753 I have an edit box, and a button. Now when you hit the button everything thing in the edit will transform. All the a's will equal 0427 etc. I need someone to point me in the right direction, what functions I'll need etc, Thanks. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Steveiwonder Posted February 12, 2010 Share Posted February 12, 2010 (edited) Something like this... Local $string = "abcd d" Local $codedstring $string = StringSplit($string, ""); splits string into array For $letter In $string Select Case $letter = "a" $codedstring = $codedstring & 100 Case $letter = "b" $codedstring = $codedstring & 200 Case $letter = "c" $codedstring = $codedstring & 300 Case $letter = "d" $codedstring = $codedstring & 400 Case $letter = "e" $codedstring = $codedstring & 500 Case $letter = " " ; space $codedstring = $codedstring & 600 EndSelect Next Msgbox(0, "Eat my code", $codedstring) Or you could look at Associative Arrays which would be easier but they haven't been implemented into autoit except via someones UDF on the example scripts forum i think. an AssocArray would be alot better as it would be like this... $letters = ["a" => "100"], ["b" => "200"], ["c" => "300"], ["d" => "400"] Then to get the value its like $value = $letter["a"] ; $value now = 100 That example is from PHP it would be alot easier like that then having a HUUUUGE select statement Steve Edited February 12, 2010 by Steveiwonder They call me MrRegExpMan Link to comment Share on other sites More sharing options...
FinalVersion Posted February 12, 2010 Author Share Posted February 12, 2010 Ok thanks, I'll have a look at all of it. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
FinalVersion Posted February 12, 2010 Author Share Posted February 12, 2010 I'm stuck atm, I know what the problem is, but I don't know how to fix it. #include <File.au3> #include <Array.au3> Local $EC, $EL _FileReadToArray(@ScriptDir & "\Data.txt", $EC) For $i = 1 To $EC[0] $EL = StringTrimLeft($EC[$i], "2") MsgBox(0, "Code", $EL[$i]) Next The problem being $EL isn't an array. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 12, 2010 Share Posted February 12, 2010 The problem being $EL isn't an array.And how is that a problem? The helpfile is very clear on that StringTrimLeft returns a string .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Steveiwonder Posted February 12, 2010 Share Posted February 12, 2010 #include <File.au3> #include <Array.au3> Local $EC _FileReadToArray(@ScriptDir & "\Data.txt", $EC) Local $EL[$EC[0]] For $i = 1 To $EC[0] $EL[$i-1] = StringTrimLeft($EC[$i], "2") MsgBox(0, "Code", $EL[$i-1]) Next Works They call me MrRegExpMan Link to comment Share on other sites More sharing options...
FinalVersion Posted February 12, 2010 Author Share Posted February 12, 2010 @AdmiralAlkex I want help, not negative comments. @Steveiwonder Thanks, I'll have a look. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 12, 2010 Share Posted February 12, 2010 @AdmiralAlkexI want help, not negative comments.Do you have a reading disorder or what? That is just ridiculous. The helpfile say that StringTrimLeft returns a STRING, not an ARRAY. You also did not say anything about what problem you had.Now if Steveiwonder guessed right on what you wanted, then good for him, but the rest of us aren't mind-readers. You need to give more details when you ask something. And you need to learn how to read english (quite funny since you write pretty good). .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
FinalVersion Posted February 12, 2010 Author Share Posted February 12, 2010 Do you have a reading disorder or what? That is just ridiculous. The helpfile say that StringTrimLeft returns a STRING, not an ARRAY. You also did not say anything about what problem you had.Now if Steveiwonder guessed right on what you wanted, then good for him, but the rest of us aren't mind-readers. You need to give more details when you ask something. And you need to learn how to read english (quite funny since you write pretty good).Seems pretty obvious to me. "I know what the problem is, but I don't know how to fix it." I was asking for a fix / way around, now I'm just going to ignore any further comments. Oh, and for the record, I read English fine. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] 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