Sign in to follow this  
Followers 0
Khalifa

Problem in using ControlClick

6 posts in this topic

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:Button; 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

Share this post


Link to post
Share on other sites



I changed the script to the following, and nothing happened as well

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")

Share this post


Link to post
Share on other sites

I even tried to Run the tutorial script of Simple Notepad, but the command Send("!n")

doesn't even work, i tried to use the flag #requireadmin, But nothing can help out,

Do you think that there is a problem in my windows 7 permissions, or what ?, who no control commands work ?

Share this post


Link to post
Share on other sites

I even tried to Run the tutorial script of Simple Notepad, but the command Send("!n")

doesn't even work, i tried to use the flag #requireadmin, But nothing can help out,

Do you think that there is a problem in my windows 7 permissions, or what ?, who no control commands work ?

Your script seems fine until you get to the ControlClick command, you haven't defined the button to click with and i'm pretty sure that why it wont work for ya.

But there's a lot of ways to fix your problem, one see if the button you want to press has a hotkey if it dose just Send the window the key. Or you can use the MouseClick command, yeah its not as nice but by using it in combination with WinSetState and @SW_MAXIMIZE like this:

WinSetState ("Vodafone Mobile Connect Lite", "", @SW_MAXIMIZE)
MouseClick ("left" {insert coords})

Since the window will always maximize when the scrip runs, the button you need to click will always be in the same place.

Share this post


Link to post
Share on other sites

Since the window will always maximize when the scrip runs, the button you need to click will always be in the same place.

As long as you don't try to run this on a machine with a different screen resolution or other UI settings.

Share this post


Link to post
Share on other sites

So waht do you think is the problem with that command,

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

since the control id is variable, i used the class name, text, and instance number to define the buttom, so what do you think else is missing ?

what information is still missing for the command to work

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