Jump to content

controlClick problem


Recommended Posts

I have this code:

#Include <File.au3>

#Include <WinAPI.au3>

$msiName = "TortoiseSVN-1.6.15.msi"

$logName = @ScriptDir & "\downloads.log"

ShellExecuteWait(@scriptdir & "\" & $msiName)

Sleep(500)

;ControlSend("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "", "[CLASS:Button; INSTANCE:2]", "This is some text")

ControlClick("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "", "[CLASS:Button; INSTANCE:2]" )

Send("+n")

I've tried with ControlSend and with ControlClick, I can not select 'Next'

Any ideas???

Thanks, Meytal

screen2.bmp

Link to comment
Share on other sites

Instead of

ShellExecuteWait(@scriptdir & "\" & $msiName)
Sleep(500)
ControlClick("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "", "[CLASS:Button; INSTANCE:2]" )

try something this

ShellExecute(@scriptdir & "\" & $msiName)
WinWait("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "")
ControlClick("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "", "[CLASS:Button; INSTANCE:2]" )
Link to comment
Share on other sites

#Include <File.au3>
#Include <WinAPI.au3>

$msiName = "TortoiseSVN-1.6.15.21042-win32-svn-1.6.16.msi"
$logName = @ScriptDir & "\downloads.log"


ShellExecuteWait(@scriptdir & "\" & $msiName)
Sleep(500)
;ControlSend("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "", "[CLASS:Button; INSTANCE:2]", "This is some text")
;ControlClick("TortoiseSVN 1.6.15.21042 (32 bit) Setup", "", "[[CLASS:Button; INSTANCE:2")

WinWaitActive("TortoiseSVN 1.6.15.21042 (32 bit) Setup")
;ControlClick("TortoiseSVN 1.6.15.21042 (32 bit) Setup","&Next >",662)
Send("+n")

WinWaitActive("TortoiseSVN 1.6.15.21042 (32 bit) License Agreement","I &accept the terms in the License Agreement")
ControlClick("TortoiseSVN 1.6.15.21042 (32 bit) License Agreement","I &accept the terms in the License Agreement",662)
Send("+n")

WinWaitActive("TortoiseSVN 1.6.15.21042 (32 bit) Setup","Ready to Install")
ControlClick("TortoiseSVN 1.6.15.21042 (32 bit) Setup","&Install",802)
WinWaitActive("TortoiseSVN 1.6.15.21042 (32 bit) Setup","dlgbmp")
Send("{ENTER}")

vietnamese.au3

Link to comment
Share on other sites

If you are getting a UAC prompt from the installer, then the installer can be running with the admin token and your script will still be running on the limited user token. You may find out that your script will fail to automate the installer windows as it will not have permissions to interact. I would put #RequireAdmin at the top of the script to test the info that I have given. :huh2:

Link to comment
Share on other sites

Thank you very much for your help,

I tried everything... but nothing is working.

I put #RequireAdmin

I used the script:

WinWaitActive("TortoiseSVN 1.6.15.21042 (32 bit) Setup")

Send("+n")

I tries this on 2 computers, one XP and one WIN7

weird scenario happen:

I run the following script once and cancel the installation process manually, so the script was still active.

I ran the same script again, and this time I had the focus and it worked.

I think that the probelm is with the focus but I'm not sure what it is exactly.

Window information:

>>>> Window <<<<

Title: TortoiseSVN 1.6.12.20536 (32 bit) Setup

Class: MsiDialogCloseClass

Position: 390, 186

Size: 499, 388

Style: 0x14C80000

ExStyle: 0x00040100

Handle: 0x001D04BA

>>>> Control <<<<

Class: Button

Instance: 2

ClassnameNN: Button2

Name:

Advanced (Class): [CLASS:Button; INSTANCE:2]

ID: 662

Text: &Next >

Position: 314, 324

Size: 74, 22

ControlClick Coords: 33, 12

Style: 0x50032001

ExStyle: 0x00000000

Handle: 0x0084024E

>>>> Mouse <<<<

Position: 740, 547

Cursor ID: 0

Color: 0xC4E7FB

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

< &Back

&Next >

Cancel

dlgbmp

Welcome to the TortoiseSVN 1.6.12.20536 (32 bit) Setup Wizard

The Setup Wizard will install TortoiseSVN 1.6.12.20536 (32 bit) on your computer. Click Next to continue or Cancel to exit the Setup Wizard.

>>>> Hidden Text <<<<

NOTE: The package you are currently installing is older than the one you already have installed. If you continue, you will downgrade your installation.

Link to comment
Share on other sites

I ran it with the script mentioned above:

ShellExecuteWait(@scriptdir & "\" & $msiName)

WinWaitActive("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "")

ControlClick("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "", "[CLASS:Button; INSTANCE:2]" )

Link to comment
Share on other sites

ShellExecuteWait(@scriptdir & "\" & $msiName)

WinWaitActive("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "")

ControlClick("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "&Next >",662)

==> OK

Edited by vietnamit
Link to comment
Share on other sites

I ran it with the script mentioned above:

ShellExecuteWait(@scriptdir & "\" & $msiName)

WinWaitActive("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "")

ControlClick("TortoiseSVN 1.6.12.20536 (32 bit) Setup", "", "[CLASS:Button; INSTANCE:2]" )

As I said in my previous post.

You must use ShellExecute instead of ShellExecuteWait

Your script breaks at ShellExecuteWait and waits for your setup to be finished!

ShellExecuteWait:

Runs an external program using the ShellExecute API and pauses script execution until it finishes.

Edited by Zedna
Link to comment
Share on other sites

  • Developers

Are you testing with 2 versions? 1.6.12 & 1.6.15 See mixed info in the postes.

It could always be that he Windows with the title is displayed but the Control install active/enabled yet.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

As I said in my previous post.

You must use ShellExecute instead of ShellExecuteWait

Your script breaks at ShellExecuteWait and waits for your setup to be finished!

Sorry... I missed the small but significant change.

Thank you, it's working now!!!

Thank you all :huh2:

Link to comment
Share on other sites

Dear All,

I'm writing my first AtuoIt script, and i got a problem with using ControlClick function,

That is my script :

Run("C:\Program Files (x86)\Vodafone\Vodafone Mobile Connect\Bin\MobileConnect.exe")

WinWaitActive("Vodafone Mobile Connect Lite", "VirtualBox Host-Only Network")

ControlClick("Vodafone Mobile Connect Lite","VirtualBox Host-Only Network","[Class:WindowsForms10.BUTTON.app.0.232467a; Text:SMS; Instance:12;]")

WinWaitActive("SMS", " Inbox")

And that is AutoIt v3 Windows Info tool :

>>>> Window <<<<

Title: Vodafone Mobile Connect Lite

Class: WindowsForms10.window.8.app.0.232467a

Position: 537, 179

Size: 549, 562

Style: 0x16CB0000

ExStyle: 0x00050100

Handle: 0x00000000002409FC

>>>> Control <<<<

Class: WindowsForms10.BUTTON.app.0.232467a

Instance: 12

ClassnameNN: WindowsForms10.BUTTON.app.0.232467a12

Name: SMS

Advanced (Class): [NAME:SMS]

ID: 5309504

Text: SMS

Position: 5, 370

Size: 133, 33

ControlClick Coords: 66, 22

Style: 0x5601000B

ExStyle: 0x00000000

Handle: 0x0000000000510440

>>>> Mouse <<<<

Position: 611, 596

Cursor ID: 0

Color: 0xEAE7E7

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

Best Connected

Off

Prompt

Automatic

Settings

Mobile Connect

Main View

Manage

Connections

View Usage

Manage Devices

Other Programs

SMS

VPN

WLAN Connections

Searching for device...

Mobile Connections

No device

LAN Connections

VirtualBox Host-Only Network

Connected

menuStrip1

>>>> Hidden Text <<<<

Actually i wish to click this SMS buttom, but the command i used do no action at all, could any one help out to find out what is my problem.

Also, if i wish to use MouseClick function, how can i make it use relative coordinates from the opend window whereever it appeares ?

Thanks in advance

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