mann Posted April 24, 2009 Posted April 24, 2009 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.
Qousio Posted April 24, 2009 Posted April 24, 2009 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" )
mann Posted April 24, 2009 Author Posted April 24, 2009 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 TitleClassnameNN = AwesomeButton1Then your control would be ControlClick( "Awesome Title", "", "AwesomeButton1", "left" )thanksThats fine, but now when i have given all the details then why this is not working. As there is not compilation error too.
Moderators Melba23 Posted April 24, 2009 Moderators Posted April 24, 2009 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Qousio Posted April 24, 2009 Posted April 24, 2009 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.
mann Posted April 24, 2009 Author Posted April 24, 2009 (edited) 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) Edited May 5, 2009 by mann
Qousio Posted April 24, 2009 Posted April 24, 2009 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.
Moderators Melba23 Posted April 24, 2009 Moderators Posted April 24, 2009 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
mann Posted April 24, 2009 Author Posted April 24, 2009 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.
Qousio Posted April 24, 2009 Posted April 24, 2009 (edited) 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: CODEHotKeySet("{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 April 24, 2009 by Qousio
mann Posted April 28, 2009 Author Posted April 28, 2009 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: CODEHotKeySet("{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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now