Andre Posted August 13, 2004 Share Posted August 13, 2004 Hi,could someone please have a look at the following :For $I = 1 To 10 If WinExists("Rekenm","") Then $Arr[$Teller] = WinGetTitle("ClassName=SciCalc","") $Teller = $Teller + 1 WinSetTitle("Rekenma","", $Teller & "Rekenmachine") $Arr[$Teller] = WinGetTitle($Teller & "Rekenmach","") $Teller = $Teller + 1 Sleep(500) EndIf NextThis works fine for me, but when i use "advanced" controls using classnameAutoItSetOption("WinTitleMatchMode", 4) For $I = 1 To 10 If WinExists("classname=SciCalc","") Then $Arr[$Teller] = WinGetTitle("ClassName=SciCalc","") $Teller = $Teller + 1 WinSetTitle("Rekenma","", $Teller & "Rekenmachine") $Arr[$Teller] = WinGetTitle($Teller & "Rekenmach","") $Teller = $Teller + 1 Sleep(500) EndIf NextIt results in an error :==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $Arr[$Teller] = WinGetTitle($Teller & "Rekenmach","") Some advice please ?Thnx.Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
Developers Jos Posted August 13, 2004 Developers Share Posted August 13, 2004 It results in an error : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $Arr[$Teller] = WinGetTitle($Teller & "Rekenmach","") Some advice please ? Thnx. Andre <{POST_SNAPBACK}>Add: Dim $Arr[10] at the top to define the array first... 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. Link to comment Share on other sites More sharing options...
Andre Posted August 13, 2004 Author Share Posted August 13, 2004 I have done that already, sorry won't work. Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
Developers Jos Posted August 13, 2004 Developers Share Posted August 13, 2004 I have done that already, sorry won't work. Andre <{POST_SNAPBACK}>Try DIM $Arr[11] since a DIM $Arr[10] is => 0 - 9 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. Link to comment Share on other sites More sharing options...
Andre Posted August 13, 2004 Author Share Posted August 13, 2004 (edited) Hi, That works indeed Thnx. Next problem : When i use the winexitst without the use of classname the whole run takea about 1,2 sec. With the use of classname it takes too long > 9 sec. how come Andre Edit : The removal of the sleep does speed it up but too less. Edited August 13, 2004 by Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
Andre Posted August 13, 2004 Author Share Posted August 13, 2004 Hi,Perhaps i should make my question more general.Am i rights that the use of classname in WinExists("classname=SciCalc","")slows down instead of using WinExistst("Calculator","") ??ThnxAndre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
pekster Posted August 13, 2004 Share Posted August 13, 2004 Am i rights that the use of classname in WinExists("classname=SciCalc","") slows down instead of using WinExistst("Calculator","") ?? <{POST_SNAPBACK}>I created a test to determine this. It opens the scientific calculator, and then performs 10,000 classname checks on it, and 10,000 title checks on it. It will then provide the time differences. You can see the code below. My results of the test were as follows: Classname time: 6.41 seconds Title time: 5.68 seconds That may sound like a huge difference, but it's really not. This is because the test was in a loop that ran 10,000 times. In reality, the classname method, according to my results, only takes 0.000073 seconds longer each time you use it. The code I used: Opt("WinTitleMatchMode", 4) If WinExists("classname=SciCalc") OR WinExists("Calculator") Then MsgBox(16, "Error", "You cannot run this test with the calc active!") Exit EndIf SplashTextOn("Working...", "Test is running. Please wait" & @LF &_ "Do not close the calculator until the test is complete") Run("calc.exe") WinWaitActive("Calculator") ControlSend("Calculator", "", "Edit1", "!vs") Sleep(500) $time1 = TimerInit() For $i = 1 To 10000 WinExists("classname=SciCalc") Next $time1 = TimerDiff($time1) $time2 = TimerInit() For $i = 1 To 10000 WinExists("Calculator") Next $time2 = TimerDiff($time2) SplashOff() MsgBox(0, "Results", "Classname time is: " & Round($time1 / 1000, 2) &_ @LF & "Title time is: " & Round($time2 / 1000, 2)) [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
emmanuel Posted August 13, 2004 Share Posted August 13, 2004 too cool not to try. Life's good when you have 2 gigs of ram: --------------------------- Results --------------------------- Classname time is: 2.7 Title time is: 2.3 --------------------------- OK --------------------------- I created a test to determine this. It opens the scientific calculator, and then performs 10,000 classname checks on it, and 10,000 title checks on it. It will then provide the time differences. You can see the code below. My results of the test were as follows: Classname time: 6.41 seconds Title time: 5.68 seconds That may sound like a huge difference, but it's really not. This is because the test was in a loop that ran 10,000 times. In reality, the classname method, according to my results, only takes 0.000073 seconds longer each time you use it. <{POST_SNAPBACK}> "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Andre Posted August 13, 2004 Author Share Posted August 13, 2004 Ok Guys, Thnx for all the respons. I'll guess it's my loop that make's it slower, but i can live with it. Regards, Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! 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