Sign in to follow this  
Followers 0
Spaceman20

Is it possible to control the buttons of a windows when the value "Control ID" is not available?

11 posts in this topic

Hello members,

i am a newbie in using the autoit tool and i want to make my first script to uninstall

a program automatically.

I want to uninstall a program from a Windows XP based computer by using a netlogon script.

My problem is that during the uninstallation process there are 3 windows where the

user have to click a "yes" and an "ok" button. I want to make a script which do this keyboard input

automatically. I used the autoit tool "Active Window Info" to analyse the needed parameters to control the windows with a script. I can only find the value "ClassNameNN" but in the manual of autoit are only discryptions to cotrol the windows by using the value "Control ID". But in the windows of the uninstall program the value "Control ID" is not available.

Is it possible to control the buttons of a windows when the value "Control ID" is not available???

I hope you can help me !!

Thank´s in advance!

Spaceman

Enclosed there is a copy of the informations which i can get from the window:

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Testprogram

Class: #32770

Size: X: 471 Y: 414 W: 458 H: 152

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 890 Y: 509

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xE0DFE3 Dec: 14737379

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 78 Y: 22 W: 362 H: 40

Control ID:

ClassNameNN: FXWindow4

Text:

Style: 0x56000000

ExStyle: 0x00000004

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

Share this post


Link to post
Share on other sites



I understand why you are confused with this.

In stead of using a ControlID use a Classname like so:

$Class = "Classname=FXWindow4"

Also a option has to be set, but I don't have AutoIt installed here. :lmao:

Share this post


Link to post
Share on other sites

I understand why you are confused with this.

In stead of using a ControlID use a Classname like so:

$Class = "Classname=FXWindow4"

Also a option has to be set, but I don't have AutoIt installed here. :lmao:

Opt('WinTitleMatchMode', 4)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Opt('WinTitleMatchMode', 4)

Thank you. I find this kind of confusing as this sets a title match mode, and you are working with controls.. However, I've never had any problems with this way of coding, so I think it's great none the less.

Edited by Manadar

Share this post


Link to post
Share on other sites

Thank you. I find this kind of confusing as this sets a title match mode, and you are working with controls.. However, I've never had any problems with this way of coding, so I think it's great none the less.

Do you have a little script example for me which show me how to use this option??

Share this post


Link to post
Share on other sites

Yes I do, and even better. I got it straight from the helpfile:

; Identify the Notepad window that contains the text "this one" and get a handle to it

; Change into the WinTitleMatchMode that supports classnames and handles
AutoItSetOption("WinTitleMatchMode", 4)

; Get the handle of a notepad window that contains "this one"
$handle = WinGetHandle("classname=Notepad", "this one")
If @error Then
    MsgBox(4096, "Error", "Could not find the correct window")
Else
    ; Send some text directly to this window's edit control
    ControlSend($handle, "", "Edit1", "AbCdE")
EndIf

Share this post


Link to post
Share on other sites

Do you have a little script example for me which show me how to use this option??Sorry but keep in mind that this is my first script :">

i have tried to control the window of the uninstall program with the following script but it doesn´t work.

[autoit]run("c:\program files\acronis\trueimage\mediabuilder.exe -uninstall")

$Class="FXwindow9"

WinWaitActive("Acronis True Image","$Class")

Send("!j")[autoit]

that are the infos of the autoit tool:

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Acronis True Image

Class: #32770

Size: X: 766 Y: 369 W: 458 H: 152

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 945 Y: 493

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0x000000 Dec: 0

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 135 Y: 78 W: 80 H: 24

Control ID:

ClassNameNN: FXWindow9

Text:

Style: 0x56000000

ExStyle: 0x00000004

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

Share this post


Link to post
Share on other sites

1st.... What is the 2nd parameter of WinWaitActive()? Is it ClassNameNN or is it Text... When you answer that question, then 2nd ... Why would you put the ClassNameNN there?

If you don't understand that, then try the below:

WinWait("Acronis True Image")
If Not WinActive("Acronis True Image") Then WinActivate("Acronis True Image")
;Assuming that FXWindow9 is what you want to interact with as the control and it's a button
ControlClick("Acronis True Image", '', "FXWindow9")
;If it's not a button then try (UnComment Send of course):
;Send("!j")

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

1st.... What is the 2nd parameter of WinWaitActive()? Is it ClassNameNN or is it Text... When you answer that question, then 2nd ... Why would you put the ClassNameNN there?

If you don't understand that, then try the below:

WinWait("Acronis True Image")
If Not WinActive("Acronis True Image") Then WinActivate("Acronis True Image")
;Assuming that FXWindow9 is what you want to interact with as the control and it's a button
ControlClick("Acronis True Image", '', "FXWindow9")
;If it's not a button then try (UnComment Send of course):
;Send("!j")
The 2nd parameter is text. But i can only see the ClasNameNN in the Window information tool.

Share this post


Link to post
Share on other sites

Why is only the value ClassNameNN available in the window. The commands are only able to work with ControlID. Aren´t they??

Share this post


Link to post
Share on other sites

The control parameter can be "Control ID", "ClassNameNN", or "Control Text".

Lar.

run("c:\program files\acronis\trueimage\mediabuilder.exe -uninstall")
WinWait("Acronis True Image")
If Not WinActive("Acronis True Image") Then WinActivate("Acronis True Image")
ControlClick("Acronis True Image",'',"FXWindow9")
Send("!j")

any idea why my script is not working!?? I have to click automatically a yes button (German:"Ja") but

nothing happens when i start the script. Only the message windows pops up when i stat the script.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Acronis True Image

Class: #32770

Size: X: 730 Y: 303 W: 458 H: 143

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 915 Y: 413

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xFEEFCE Dec: 16707534

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 135 Y: 78 W: 80 H: 21

Control ID:

ClassNameNN: FXWindow9

Text:

Style: 0x56000000

ExStyle: 0x00000004

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

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