ioliver Posted October 15, 2004 Posted October 15, 2004 (edited) Ok, here's my code: While 2 $strEngTitle = WinGetTitle("") $arrayEngTitle = StringSplit($strEngTitle, chr(32)) For $x = 1 to UBound($arrayEngTitle) Call("Translate") Next For $x = 1 to UBound($arrayEngTitle) $strSpaTitle = $strSpaTitle & $arrayEngTitle[$x] & " " Next WinSetTitle($strEngTitle, "", $strSpaTitle) Wend Func Translate() StringLower($arrayEngTitle) Select Case $arrayEngTitle[$x] = "windows" $arrayEngTitle[$x] = "ventanas" Case $arrayEngTitle[$x] = "notepad" $arrayEngTitle[$x] = "nota tableta" EndSelect EndFunc I get an error message (dimension range exceeded) when I run this script. I'm sure the problem is using the $arrayEngTitle[$x] in the Function. But I don't know what the problem could be. Any suggestions would be great. Thanks again for all your help, Ian Edited October 15, 2004 by ioliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
Developers Jos Posted October 15, 2004 Developers Posted October 15, 2004 (edited) Ok, here's my code:StringLower($arrayEngTitle)<{POST_SNAPBACK}>This doesn't look right.Its missing the [.] and the result goes no where... Edited October 15, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Developers Jos Posted October 15, 2004 Developers Posted October 15, 2004 For $x = 0 to (UBound($arrayEngTitle) - 1)<{POST_SNAPBACK}>I guess with stringsplit it should be:For $x = 1 to (UBound($arrayEngTitle) - 1)orFor $x = 1 to $arrayEngTitle[0] SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ioliver Posted October 15, 2004 Author Posted October 15, 2004 Thanks, here's the new code: While 2 $strEngTitle = WinGetTitle("") $arrayEngTitle = StringSplit($strEngTitle, chr(32)) For $x = 0 to (UBound($arrayEngTitle) - 1) Call("Translate") Next For $x = 0 to (UBound($arrayEngTitle) - 1) $strSpaTitle = $strSpaTitle & $arrayEngTitle[$x] & " " Next WinSetTitle($strEngTitle, "", $strSpaTitle) Wend Func Translate() $arrayEngTitle1 = StringLower($arrayEngTitle[$x]) Select Case $arrayEngTitle1 = "windows" $arrayEngTitle[$x] = "ventanas" Case $arrayEngTitle1 = "notepad" $arrayEngTitle[$x] = "nota tableta" EndSelect EndFunc I added you suggestions and the Script doesn't blow up anymore, but it also doesn't work the way I intended it to. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
ioliver Posted October 15, 2004 Author Posted October 15, 2004 (edited) Thanks Larry... It's not an important script anyway. I'm just trying to kill time, and improve my AutoIt skills. Ian Edit: Added, and improve my AutoIt skills... Plus, it is stupid question day anyway... Edited October 15, 2004 by ioliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
Developers Jos Posted October 15, 2004 Developers Posted October 15, 2004 Thanks Larry... It's not an important script anyway. I'm just trying to kill time, and improve my AutoIt skills.IanEdit: Added, and improve my AutoIt skills...Plus, it is stupid question day anyway...<{POST_SNAPBACK}>- stupid question day was yesterday.... - believe he's trying to make a point here.. like what did you do to debug it? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ioliver Posted October 15, 2004 Author Posted October 15, 2004 - stupid question day was yesterday.... - believe he's trying to make a point here.. like what did you do to debug it?<{POST_SNAPBACK}>You're right... I haven't done anything, I guess I was just looking for a handout. I'll look into is some more.Thanks again,Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
scriptkitty Posted October 15, 2004 Posted October 15, 2004 Just a bit of FYI: $arrayEngTitle = StringSplit($strEngTitle, chr(32)) For $x = 1 to UBound($arrayEngTitle) Stringsplit automatically gives the ammount of elements -1 to [0] so you can also use this as well as removing 1 from the ubound: $arrayEngTitle = StringSplit($strEngTitle, chr(32)) For $x = 1 to $arrayEngTitle[0] Dim $Array[2] has two elements $Array[0] $Array[1] that is why Ubound($Array)=2 and for $x=1 to Ubound($Array) would cause you problems in that part. AutoIt3, the MACGYVER Pocket Knife for computers.
scriptkitty Posted October 15, 2004 Posted October 15, 2004 (edited) Well since it seems these days to be unknown, I cheat. There is a very highly secretive little place where all this info and more are held. We Gurus in the field make sure that this kind of information never gets out to the public. The way we do that is to hide it in a "help file" or as others call it, a "Manual." The thought of reading anything called a Manual that might offer help is strickly forbidden in many cultures and cliques. The best place to hide something is in plain sight, so we have hidden all this and more where no one would ever dare to look..... on a side note though, many obvious things are often missed by very smart people. This is the "can't see the forest because of all the trees" symptom. And cleaning up code, alternate approaches, and a new way of looking at solving a problem are things I really enjoy. Edited October 15, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers.
ioliver Posted October 18, 2004 Author Posted October 18, 2004 Thanks scriptkitty. With you suggestions, it's working a little better. I'm going to keep working with it. Of course, I'll need a better English to Spanish Dictionary Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
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