Sign in to follow this  
Followers 0
Andre

Classname Error

9 posts in this topic

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
Next

This works fine for me, but when i use "advanced" controls using classname

AutoItSetOption("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
Next

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


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites



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

:ph34r:


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

I have done that already,

sorry won't work.

Andre

<{POST_SNAPBACK}>

Try DIM $Arr[11] since a DIM $Arr[10] is => 0 - 9

:ph34r:


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites

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","") ??

Thnx

Andre


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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!

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