Sign in to follow this  
Followers 0
bigassmuffin

How to read words in a editbox..

5 posts in this topic

Func _Translate
Local $quite = 0
    If $option = "English to code" then
        If $text = "hello" then
            GUICtrlDelete( $Edit2 )
            $Edit2 = GUICtrlCreateEdit("xz4", 8, 184, 305, 97)
        EndIf
    ElseIf $option = "code to English" then
        If $text = "xz4" then
            GUICtrlDelete( $Edit2 )
            $Edit2 = GUICtrlCreateEdit("hello", 8, 184, 305, 97)
        EndIf
    EndIf
EndFunc

I put random example in there for a better understanding.

The problem is, if I type for example, "Hello Fred", it will not translate, only if the "Hello" is alone.

So in vb I know the commands are len(variable) and mid(variable, start, leanth)

How do i do that in autoit?

or any other way...?

As always, I REALLY appreciate your time and support,

THANKS!

BigAssmuffin

Share this post


Link to post
Share on other sites



1. GUICtrl*Function + Read = GUICtrlRead()

2. String questions would have been answered had you cracked open the help file :) I don't know VB, but I would bet that:

len(variable) = StringLen($variable)

mid(variable, start, length) = StringMid($variable, $nStart, $nLen)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

1. GUICtrl*Function + Read = GUICtrlRead()

2. String questions would have been answered had you cracked open the help file :) I don't know VB, but I would bet that:

len(variable) = StringLen($variable)

mid(variable, start, length) = StringMid($variable, $nStart, $nLen)

Ya, i jsut figured out the leanth one, is there a way though to check for an entire word, instead of looking letter by letter?

Because with the stringmid command I would have to do:

If StringMid($variable, $nStart, 1) = "H" or If StringMid($variable, $nStart, 1) = "h" then
If StringMid($variable, $nStart+1, 1) = "E" or If StringMid($variable, $nStart+1, 1) = "e" then
If StringMid($variable, $nStart+2, 1) = "L" or If StringMid($variable, $nStart+2, 1) = "l" then
If StringMid($variable, $nStart+3, 1) = "L" or If StringMid($variable, $nStart+3, 1) = "l" then
If StringMid($variable, $nStart+4, 1) = "O" or If StringMid($variable, $nStart+4, 1) = "o" then
GUICtrlDelete( $Edit2 )
$Edit2 = GUICtrlCreateEdit("howdy", 8, 184, 305, 97)
EndIf
EndIf
EndIf
EndIf
EndIf

I think theres an easier way...?

Edited by bigassmuffin

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ya, i jsut figured out the leanth one, is there a way though to check for an entire word, instead of looking letter by letter?

Because with the stringmid command I would have to do:

If StringMid($variable, $nStart, 1) = "H" or If StringMid($variable, $nStart, 1) = "h" then
If StringMid($variable, $nStart+1, 1) = "E" or If StringMid($variable, $nStart+1, 1) = "e" then
If StringMid($variable, $nStart+2, 1) = "L" or If StringMid($variable, $nStart+2, 1) = "l" then
If StringMid($variable, $nStart+3, 1) = "L" or If StringMid($variable, $nStart+3, 1) = "l" then
If StringMid($variable, $nStart+4, 1) = "O" or If StringMid($variable, $nStart+4, 1) = "o" then
GUICtrlDelete( $Edit2 )
$Edit2 = GUICtrlCreateEdit("howdy", 8, 184, 305, 97)
EndIf
EndIf
EndIf
EndIf
EndIf
Note: == would be case sensitive, just using = is not case sensitive.
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

If you gave an actual "working" example instead of sporadic code, maybe I could show you something... or else, all I can suggest is StringRegExp() and you figure out how to use it.

Edit:

Or ... looking at your code:

If StringLeft($variable, 4) = 'hello' Then
Note: == would be case sensitive, just using = is not case sensitive.

Ill try this, thanks!

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