Jump to content

ControlClick ComboBox


Recommended Posts

Need it to Click the Combo Box. I got it to work with MouseClick but I dont want to have to depend on resolution of computer. Nor do I want it to move the mouse. Just click.

This is the code I am trying...

ControlClick("Connect to gem.ins.dell.com","",1003,"left",1)

>>>> Window <<<<

Title: Connect to gem.ins.dell.com

Class: #32770

Position: 477, 357

Size: 326, 282

Style: 0x94C82BCC

ExStyle: 0x00010501

>>>> Control <<<<

Class: ComboBox

Instance: 1

ID: 1003

Text:

Position: 596, 485

Size: 169, 22

ControlClick Coords: 7, 12

Style: 0x56000413

ExStyle: 0x00000000

>>>> Mouse <<<<

Position: 603, 497

Cursor ID: 0

Color: 0x000000

>>>> StatusBar <<<<

>>>> Visible Text <<<<

Connecting to gem.ins.dell.com

&User name:

gem.ins.dell.com\sdasad

gem.ins.dell.com\sdasad

&...

&Password:

&Remember my password

OK

Cancel

>>>> Hidden Text <<<<

Link to comment
Share on other sites

  • Moderators

Look up ControlCommand().

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.

Link to comment
Share on other sites

...and in case your app resists ControlCommand() like some of mine do,

try this little demo:

Run("notepad")
WinWaitActive("Untitled - Notepad")
Send    ][ÝÉÌÌÎÙI][ÝÊBÚ[ØZ]]][ÝÔØ]][ÝÊBÚ[[ÝJ  ][ÝÔØ]2gV÷C²ÂgV÷C²gV÷C²Â ¤6öçG&öÄfö7W2gV÷Cµ6fR2gV÷C²ÂgV÷C²gVÐì°ÅÕ½Ðí
½µ½  ½àÈÅÕ½Ðì¤)
½¹Ñɽ±M¹ ÅÕ½ÐíMÙÌÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°uot;ComboBox2", "{DOWN 2}{ENTER}")oÝ÷ Ùשzwb!jج{azX¬¶Ç§v)ර-}ì%zÛ^®Ê¶¥w¢~)íz·¬·¥©l£
+«­¢+Ù
½¹Ñɽ±M¹ ÅÕ½ÐíMÙÌÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí
½µ½  ½àÈÅÕ½Ðì°ÅÕ½Óa")

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I'm having a problem clicking this OK on this box.

Is this the right code?

If WinExists("Security Alert") Then ControlClick("Security Alert","",1,"left",1)

>>>> Window <<<<

Title: Security Alert

Class: #32770

Position: 339, 284

Size: 345, 171

Style: 0x94C80AC4

ExStyle: 0x00010101

>>>> Control <<<<

Class: Button

Instance: 1

ID: 1

Text: OK

Position: 515, 418

Size: 75, 23

ControlClick Coords: 35, 9

Style: 0x50010000

ExStyle: 0x00000004

>>>> Mouse <<<<

Position: 550, 427

Cursor ID: 0

Color: 0xD4D0C8

>>>> StatusBar <<<<

>>>> Visible Text <<<<

OK

You are about to view pages over a secure connection.

&In the future, do not show this warning

&More Info

Any information you exchange with this site cannot be viewed by anyone else on the Web.

>>>> Hidden Text <<<<

Link to comment
Share on other sites

ControlFocus worked perfectly!! Thanks!

You are welcome...

I would not have know about it had the help file not mentioned it under ControlSend:The control might first need to be given focus with the ControlFocus command,...

Edit: Perhaps I should have said that I fought something like this too until I found that hint in the help file.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Hello all!!

I'm a newbie at autoit and i have a problem similar..... :rolleyes:

How can i click to the button loaded after an https websurfing (security alert due to non recognized certificate by IE CA) ??

In my code i have :

ControlClick("Alerte de sécurité", "", "[CLASS:Button; TEXT:&Oui; INSTANCE:1]")

Is anything missing?

The doc say : ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] )

I don't really understand what is the second parameter (text) in this function... i have tried to insert the whole window text without success

Thanks for your help!

Summary :

>>>> Window <<<<

Title: Alerte de sécurité

Class: #32770

Position: 448, 326

Size: 384, 308

Style: 0x94C808C4

ExStyle: 0x00010101

>>>> Control <<<<

Class: Button

Instance: 1

ID: 1

Text: &Oui

Position: 499, 597

Size: 90, 23

ControlClick Coords: 45, 13

Style: 0x50010000

ExStyle: 0x00000004

>>>> Mouse <<<<

Position: 96, 284

Cursor ID: 0

Color: 0xF8F5E3

>>>> StatusBar <<<<

>>>> Visible Text <<<<

Les informations que vous échangez avec ce site ne peuvent pas être consultées ou modifiées par d'autres utilisateurs. Cependant, un problème concernant le certificat de sécurité de ce site a été détecté.

Le certificat de sécurité a été émis par une société à laquelle vous n'avez pas choisi de faire confiance. Consultez le certificat pour décider si vous souhaitez faire confiance à l'autorité de certification.

La date du certificat de sécurité est valide.

Le certificat de sécurité a un nom valide qui correspond au nom de la page que vous essayez d'afficher.

Voulez-vous continuer ?

&Oui

&Non

A&fficher le certificat

>>>> Hidden Text <<<<

Link to comment
Share on other sites

Try this:

have the window of interest up like you have in your screen shot

run a test script with just this one line of code in it

ControlClick("Alerte de sécurité", "", "Button1")

If the ControlClick works, then you have a problem with your script not waiting for the screen to appear before it sends the ControlClick.

You could also try a line like this (with the window of interest up):

MsgBox(0, "", ControlClick("Alerte de sécurité", "", "Button1"))

If the MsgBox shows a 0 - then the control probably was not found.

If the MsgBox shows a 1 - then the control was found and the click has a chance (but not a guarantee of working)

post back with your results...

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Thanks!

it seems to work with an only line... the button is clicked...

I don't understand that is does not work in my script...

For information the Msgbox return value is 0...... seems to be not ok...

here is my script :

#include <IE.au3>

Opt("WinTitleMatchMode", 3)

$fenetre = _IECreate ("http://secret.website.com",1)

$lien = _IEImgClick($fenetre,"cadenas2.gif")

sleep(4)

ControlClick("Alerte de sécurité", "", "Button1")

Do you have any idea?

Thanks

Link to comment
Share on other sites

Thanks!

it seems to work with an only line... the button is clicked...

I don't understand that is does not work in my script...

For information the Msgbox return value is 0...... seems to be not ok...

here is my script :

#include <IE.au3>

Opt("WinTitleMatchMode", 3)

$fenetre = _IECreate ("http://secret.website.com",1)

$lien = _IEImgClick($fenetre,"cadenas2.gif")

sleep(4)

ControlClick("Alerte de sécurité", "", "Button1")

Do you have any idea?

Thanks

Just as I thought - you are not waiting long enough for the window to appear. Your sleep is only 4 milliseconds long.

Replace that sleep line with:

WinWait("Alerte de sécurité")

WinActivate("Alerte de sécurité")

WinWaitActive("Alerte de sécurité")

...the your ControlClick

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Hello herewasplato !! I'm back :rolleyes:

Arff, I have not read the doc of the sleep time fucntion.

I have modified my script according to your proposition but without success.

It seems that the window "aletre de sécurité" appears and autoit script are not aware of it... even if i list all the widows....

A msgbox line test (after clicking the link who make appear the window alerte de sécurité) seems to not be executed....

Here is my script ...

I don't really understand what happen.

#include <IE.au3>

;;Opt("WinTitleMatchMode", 3)

$fenetre = _IECreate ("http://secret.website.com",1)

$lien = _IEImgClick($fenetre,"cadenas2.gif")

sleep(1000)

$var = WinList()

For $i = 1 to $var[0][0]

; Only display visble windows that have a title

If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then

MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])

EndIf

Next

Func IsVisible($handle)

If BitAnd( WinGetState($handle), 2 ) Then

Return 1

Else

Return 0

EndIf

EndFunc

MsgBox(0,"before winwait","avant WinWait")

WinWait("Alerte de sécurité")

MsgBox(0,"after winwait","apres winwait")

WinActivate("Alerte de sécurité")

MsgBox(0,"apres WinActivate")

WinWaitActive("Alerte de sécurité","")

MsgBox(0,"after WinWaitActive","apres WinWaitActive")

ControlClick("Alerte de sécurité", "", "Button1")

Link to comment
Share on other sites

Hello herewasplato !! I'm back :rambo:

Arff, I have not read the doc of the sleep time fucntion.

I have modified my script according to your proposition but without success.

It seems that the window "aletre de sécurité" appears and autoit script are not aware of it... even if i list all the widows....

A msgbox line test (after clicking the link who make appear the window alerte de sécurité) seems to not be executed....

Here is my script ...

I don't really understand what happen.

I get an IIS "Under Construction" page from that URL. Can you provide a web page that shows the problem?

:rolleyes:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I have found the solution in IE.au3 :

The _IECreate fucntion have some parameters, that in my case, and by default, wait IE to load the entire page.

In my case, the pop-up appear after the connexion to the URL and the script wait that IE to load the page before activating the next instruction.

So : the third parameter $f_wait must be at 0 instead of the default value to 1 :

$fenetre = _IECreate ("http://XYZ.com/index.htm",0,1,0,1)

Function Name: _IECreate()

; Description: Create an Internet Explorer Browser Window

; Parameter(s): $s_Url - Optional: specifies the Url to navigate to upon creation

; $f_tryAttach - Optional: specifies whether to try to attach to an existing window

; 0 = (Default) do not try to attach

; 1 = Try to attach to an existing window

; $f_visible - Optional: specifies whether the browser window will be visible

; 0 = Browser Window is hidden

; 1 = (Default) Browser Window is visible

; $f_wait - Optional: specifies whether to wait for page to load before returning

; 0 = Return immediately, not waiting for page to load

; 1 = (Default) Wait for page load to complete before returning

; $f_takeFocus - Optional: specifies whether to bring the attached window to focus

; 0 = Do Not Bring window into focus

; 1 = (Default) bring window into focus

Thanks!

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