Jump to content
Sign in to follow this  
mann

Problem with Control Click option

Recommended Posts

mann

Hi,

I am facing problem in using control click option. ^_^ I am trying to automate a POS(Point of Sale ) application. when i am trying to click on button, it doesn't work.

Actually, it is a toolstrip menu with button on it.

Script:

Run("C:\Program Files\POS\POS.Lounge.exe")

WinWaitActive("POS v2.0.0.78 [Airport Arrival - T01]","",300)

ControlFocus(" POS v2.0.0.78 [ Airport Arrival - T01]","","tsbon")

ControlClick("POS v2.0.0.78 [Airport Arrival - T01]","","tsbon","left",1,65,40)

This code doesn't click the button, i m referring.

One more problem: How do we know controlId, I m not getting it with Window Info tool. ;)

Share this post


Link to post
Share on other sites
Qousio

Hi,

I am facing problem in using control click option. ^_^ I am trying to automate a POS(Point of Sale ) application. when i am trying to click on button, it doesn't work.

Actually, it is a toolstrip menu with button on it.

Script:

Run("C:\Program Files\POS\POS.Lounge.exe")

WinWaitActive("POS v2.0.0.78 [Airport Arrival - T01]","",300)

ControlFocus(" POS v2.0.0.78 [ Airport Arrival - T01]","","tsbon")

ControlClick("POS v2.0.0.78 [Airport Arrival - T01]","","tsbon","left",1,65,40)

This code doesn't click the button, i m referring.

One more problem: How do we know controlId, I m not getting it with Window Info tool. ;)

Uh.. I'm not really sure what youre trying to do. But if you hover the Window Info tool over a button and it says:

Title: Awesome Title

ClassnameNN = AwesomeButton1

Then your control would be ControlClick( "Awesome Title", "", "AwesomeButton1", "left" )

Share this post


Link to post
Share on other sites
mann

Uh.. I'm not really sure what youre trying to do. But if you hover the Window Info tool over a button and it says:

Title: Awesome Title

ClassnameNN = AwesomeButton1

Then your control would be ControlClick( "Awesome Title", "", "AwesomeButton1", "left" )

thanks

Thats fine, but now when i have given all the details then why this is not working. As there is not compilation error too.

Share this post


Link to post
Share on other sites
Melba23

mann,

Perhaps if you tried:

ControlClick( "Awesome Title", "", "[CLASS:AwesomeButton1]")

That should give you 1 left click on the button.

If you need more ID you might need to add the INSTANCE as well - only trying will answer that.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Qousio

thanks

Thats fine, but now when i have given all the details then why this is not working. As there is not compilation error too.

Try not to use this part of your script:

WinWaitActive("POS v2.0.0.78 [Airport Arrival - T01]","",300)

ControlFocus(" POS v2.0.0.78 [ Airport Arrival - T01]","","tsbon")

And try not using the 65,40 part in the end of ControlClick.

Share this post


Link to post
Share on other sites
mann

mann,

Perhaps if you tried:

ControlClick( "Awesome Title", "", "[CLASS:AwesomeButton1]")

That should give you 1 left click on the button.

If you need more ID you might need to add the INSTANCE as well - only trying will answer that.

M23

Thanks M23,

I have added class keyword too before control id, but still its not working. I m attaching the screenshot of my application.

I want to click on the On button. (that is not exactly a button, it is some icon on tool strip menu)

post-48902-1240559375_thumb.jpg

Edited by mann

Share this post


Link to post
Share on other sites
Qousio

Thanks M23,

I have added class keyword too before control id, but still its not working. I m attaching the screenshot of my application.

I want to click on the On button. (that is not exactly a button, it is some icon on tool strip menu)

Grr, Why didnt you tell us its an icon ^_^

Just use ControlClick( "Awesome Title", "", "", left, 1, x, y)

Where x,y is the button location.

Share this post


Link to post
Share on other sites
Melba23

mann,

Looks like the CLASS name might refer to a larger area - do you get a large rectangle including many buttons outlined on the app when you use the Au3Info Tool? This is a common problem, meaning you need to specify the location within this large control as well - the Au3InfoTool gives that information to you under "Control - ControlClick Coords" when you have the cursor over the "OK" button-that-is-not-really-a-button. Then you need to code something like:

ControlClick( "Awesome Title", "", "[CLASS:AwesomeButton1]" "left", 1, x, y)

Where x and y are the coords from the Info tool.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
mann

mann,

Looks like the CLASS name might refer to a larger area - do you get a large rectangle including many buttons outlined on the app when you use the Au3Info Tool? This is a common problem, meaning you need to specify the location within this large control as well - the Au3InfoTool gives that information to you under "Control - ControlClick Coords" when you have the cursor over the "OK" button-that-is-not-really-a-button. Then you need to code something like:

ControlClick( "Awesome Title", "", "[CLASS:AwesomeButton1]" "left", 1, x, y)

Where x and y are the coords from the Info tool.

M23

I m using code as :

Run("C:\Program Files\POS\POS.Lounge.exe")

ControlClick("POS v2.0.0.78 [Delhi Airport Arrival - T01]","","[CLASS:WindowsForms10.window.8.app.0.2004eee; INSTANCE:13:tbson]","left",1,40,30)

It is opening the application and then doesnot do anything.

Share this post


Link to post
Share on other sites
Qousio

I m using code as :

Run("C:\Program Files\POS\POS.Lounge.exe")

ControlClick("POS v2.0.0.78 [Delhi Airport Arrival - T01]","","[CLASS:WindowsForms10.window.8.app.0.2004eee; INSTANCE:13:tbson]","left",1,40,30)

It is opening the application and then doesnot do anything.

Please read my post above ^_^ Not all programs can be accesed with Classes. Just remove the [class] part and you should be fine. I would suggest this:

Run("C:\Program Files\POS\POS.Lounge.exe")

WinWaitActive("POS v2.0.0.78 [Delhi Airport Arrival - T01]")

ControlClick("POS v2.0.0.78 [Delhi Airport Arrival - T01]","","","left",1,40,30)

If this still doesn't work, then you found the pixel locations wrong. Use this to find the correct coordinates:

CODE
HotKeySet("{ESC}", "Terminate") ;Выкл.

HotKeySet("{F9}", "ShowMe") ;Вкл.

Dim $Runner

While 1 ;Ждет пока запустится $Runner.

Sleep(20)

If $Runner Then Start()

WEnd

Func ShowMe() ;Для включения.

$Runner = Not $Runner

EndFunc

Func Terminate() ;Для выключения.

Exit 0

EndFunc

Func Start()

$pos = MouseGetPos() ;Берет положение курсора.

MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) ;Создает сообщение с положением пикселей.

EndFunc

Run the script, move your mouse to where the icon/button is and press F9. A message will pop up with the x,y coords. Edited by Qousio

Share this post


Link to post
Share on other sites
mann

Please read my post above ^_^ Not all programs can be accesed with Classes. Just remove the [class] part and you should be fine. I would suggest this:

Run("C:\Program Files\POS\POS.Lounge.exe")

WinWaitActive("POS v2.0.0.78 [Delhi Airport Arrival - T01]")

ControlClick("POS v2.0.0.78 [Delhi Airport Arrival - T01]","","","left",1,40,30)

If this still doesn't work, then you found the pixel locations wrong. Use this to find the correct coordinates:

CODE
HotKeySet("{ESC}", "Terminate") ;Выкл.

HotKeySet("{F9}", "ShowMe") ;Вкл.

Dim $Runner

While 1 ;Ждет пока запустится $Runner.

Sleep(20)

If $Runner Then Start()

WEnd

Func ShowMe() ;Для включения.

$Runner = Not $Runner

EndFunc

Func Terminate() ;Для выключения.

Exit 0

EndFunc

Func Start()

$pos = MouseGetPos() ;Берет положение курсора.

MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) ;Создает сообщение с положением пикселей.

EndFunc

Run the script, move your mouse to where the icon/button is and press F9. A message will pop up with the x,y coords.
Still its not working, by using the same above code.

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  

×