bigassmuffin Posted January 21, 2007 Posted January 21, 2007 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
Moderators SmOke_N Posted January 22, 2007 Moderators Posted January 22, 2007 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) 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.
bigassmuffin Posted January 22, 2007 Author Posted January 22, 2007 (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 January 22, 2007 by bigassmuffin
Moderators SmOke_N Posted January 22, 2007 Moderators Posted January 22, 2007 (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 EndIfNote: == would be case sensitive, just using = is not case sensitive. Edited January 22, 2007 by SmOke_N 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.
bigassmuffin Posted January 22, 2007 Author Posted January 22, 2007 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' ThenNote: == would be case sensitive, just using = is not case sensitive. Ill try this, thanks!
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