Jump to content

Automaticaly click button


Recommended Posts

Hello guys, first i want to say i'm new in autoit scripting and sorry if my problem may be rude

I want to automaticaly click a button on a window when the window appears.

The window info is pasted below:

>>>> Window <<<<

Title: Total Commander

Class: TExtMsgForm

Position: 681, 428

Size: 444, 123

Style: 0x96C80000

ExStyle: 0x00000101

Handle: 0x001101AA

>>>> Control <<<<

Class: TButton

Instance: 3

ClassnameNN: TButton3

Name:

Advanced (Class): [CLASS:TButton; INSTANCE:3]

ID: 1114728

Text: &Skip

Position: 10, 67

Size: 136, 23

ControlClick Coords: 82, 13

Style: 0x54010000

ExStyle: 0x00000000

Handle: 0x00110268

>>>> Mouse <<<<

Position: 776, 533

Cursor ID: 0

Color: 0xDADADA

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

&Abort

R&etry

&Skip

>>>> Hidden Text <<<<

This is what i wrote in the .au3 file:

WinWaitActive("[CLASS:TExtMsgForm]")

ControlClick("[CLASS:TExtMsgForm]" , "" , "[CLASS:TButton ; INSTANCE:3]")

It seems that the window is detected because the script closes after window appears but no button is pressed

Also i want to run the script until i will press a key combination such alt+ctrl+x an not to close himself after detecting the window.

I must say that i run the script by double clicking the .au3 file and not by compiling the .au3 to exe and than running the exe , i don't know if this could be a problem.

Thanks in advance

Link to comment
Share on other sites

It sounds like you dont have a loop setup. I cant tell because I dont see your code. Your program will close after it has done something unless you tell the program to loop. This is a very common thing and it looks like this:

While 1

do something

Wend

I use the home key to end my program or I use the pause key to just pause the script. At the top of the script i put:

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{HOME}", "Terminate")
$Paused = $Paused
send("{pause}")

and at the bottom (or anywhere) I put:

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

If I hit home it closes the program and if I hit pause then the script pauses.

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

I don't know enough to be sure, because I only looked at the ControlClick help file and the Au3Info tool for about 2 minutes.

Buuut, it looks like you're using the "Advanced Mode" value where the Control ID should be, have you tried using the ID instead of [CLASS:TButton ; INSTANCE:3]?

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