Jump to content

tell me why ?


cxcio
 Share

Recommended Posts

i used this code when the control got focus, it work fine ...

;$a="ThunderRT6CommanddButton4"
$a = ControlGetFocus("MyWin")
ControlLeftClick("MyWin","",$a)
msgbox(0,"",$a)

and in this code , i used msgbox to show the $a's value, it is alse "ThunderRT6CommanddButton4"

but if i use this, i failed ... why ???

$a="ThunderRT6CommanddButton4"
;$a = ControlGetFocus("MyWin")
ControlLeftClick("MyWin","",$a)
msgbox(0,"",$a)

who can help ?

Link to comment
Share on other sites

According to the helpfile ..

The control might first need to be given focus with the ControlFocus command.

When using a control name in the Control functions you need to add a number to the end of the name to indicate which control.  For example, if there two controls listed called "MDIClient" then you would refer to these as "MDIClient1" and "MDIClient2".

Have you tried using the ControlFocus() command when assigning the value from a literal (ie: in your sample that fails)?
Link to comment
Share on other sites

my helpfile have not the "The control might first need to be given focus with the ControlFocus command.

" , my autoit vision is v3.0.86.

i tried the ControlFocus("MyWin","","ThunderRT6CommanddButton4") , it also did nothing ... :whistle:

Edited by cxcio
Link to comment
Share on other sites

I tried to duplicate your results..

Target.au3

;offer three buttons to choose from
    $nRC = msgbox (4096 + 3, "MyWin", "Click My Buttons!")  

;Confirm which button got pressed
    msgbox (4096 + 64, "nRC" , $nRC)

AutoBot.au3

;Wait till the target appears
    WinWaitActive ("MyWin")

;Announce start of processing
    ProgressOn("Hmmmmmmm","Target identified!")
    sleep(2000)
    ProgressOff()

;Click a button - from cxcio's code 
    WinActivate("MyWin")
    $a="Button3"   ;hard-coded
    ControlLeftClick("MyWin","",$a)
    msgbox(0,"",$a)

I started Target.au3, and left the msgbox on the screen. Then started AutoBot.au3, which sat and waited for me.

As soon as I made the msgbox active again (Window = "MyWin", from Target.au3) .. AutoBot.au3 woke up and everything worked as expected: it clicked the Cancel button.

Suggestion - if this works for you too, and you still can't get your "ThunderRT6CommanddButton4" to work then it may be that the thunder-button doesn't behave the same way.

Assuming you're 100% certain that the spelling is correct for "ThunderRT6CommanddButton4" .. right?

Hope this helps :whistle:

Link to comment
Share on other sites

looks like a spelling mistake in "$a="ThunderRT6CommanddButton4"

extra d between Command and Button

[quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...