Sign in to follow this  
Followers 0
FinalVersion

Couple Questions

9 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 :mellow: it would be alot easier like that then having a HUUUUGE select statement

Steve

Edited by Steveiwonder

They call me MrRegExpMan

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

@AdmiralAlkex

I 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).

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0