Jump to content

Recommended Posts

#Include <WinAPI.au3>

local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]")))
ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:"&$ClassName&"; INSTANCE:1]", "primary")

When I am running this script it just gives me a ConsoleWrite output of "0x001D04A8"

When using "AutoIT v3 Window Info" all the info I need for the ControlClick is there and displayed perfectly as if I typed it in normally.

Upon click the button it should be clicking it, I see the following inn the console window:

Quote

0x001D04A8
1
0
0x001D04A8

If I replace the $ClassName with the actual ClassName of "WindowsForms10.BUTTON.app.0.3296db7_r14_ad1" it works just fine, any ideas???

Edited by Yirrlaar

Share this post


Link to post
Share on other sites

After declaring $ClassName, write the resultant variable to the console. Is the variable what you expect it to be?

local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]")))
ConsoleWrite($ClassName & @CRLF)

 

Share this post


Link to post
Share on other sites

Yes, it is 100% exactly as it should be:

#Include <WinAPI.au3>

local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]")))
ConsoleWrite($ClassName & @CRLF)
;Give's WindowsForms10.BUTTON.app.0.3296db7_r14_ad1
ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:"&$ClassName&"; INSTANCE:1]", "primary")
;does nothing
sleep(60000)
ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:WindowsForms10.BUTTON.app.0.3296db7_r14_ad1; INSTANCE:1]", "primary")
;finally clicks the item it's suppose to

 

Edited by Yirrlaar

Share this post


Link to post
Share on other sites

You think that getting the window's class is going to give you the class of the control?  I think you need to output to console your $classname variable, and see that is not the case.

I might believe you if you were getting the class of the focused control inside the active window if your control was in fact focused upon, and the window containing the controls was in fact active.

It's much safer to be explicit in what you are attempting to automate rather than look to active windows.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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  

  • Similar Content

    • By AutoPM
      #RequireAdmin AutoItSetOption('MouseCoordMode', 0) If WinExists("newtitle") Then ControlClick('newtitle', '', 'Button1') EndIf a Simple script to click Button on GUI with title "newtitle". this script is working fine on my laptop on [windows 10, windows 7]
      but on a different laptop. script is not clicking this button, is there any alternative to control click then please tell. don't want to use mouseclick 
       
      Thank you
    • By tentacole
      Afternoon!
      This is my first post, so I apologize if this is in the wrong place. 
      I've created a while loop to click in a certain area of an application, and have the y axis change at the end of each loop. My loop continues to click at x:27, x:10, even though the $y is adding 15 at the end of each loop. I did a Send($x) and Send($y) into a Notepad to see if the $y had changed after each loop, and the 15 was being added to $y each loop. (If this makes sense)
       
      I'm unsure where I'm going wrong, and would be extremely grateful if someone can point me in the correct direction to fix this. 
      Local $rDirectory = "H:\oDemandProject\fList.txt" Local $rLine = _FileCountLines($rDirectory) Local $x = 27 Local $y = 10 While $rline > 0 WinActivate("OnDemand", "-> 1") WinWaitActive("OnDemand", "-> 1") ControlClick("OnDemand", "", "[CLASS:AfxFrameOrView120u; INSTANCE:1]", "left", 4, $x, $y) $y += 15 $rLine -= 1 WEnd  
    • By Tats
      Hi everyone,
      I have a problem with ControlClick function. It doesn't work no matter how I tried all the possible combination of the parameters.
      Below is the scripts of possible parameter combination:
      ;ControlClick("title","text","controlID ","button","clicks","x","y") ;title= Title, Class, Handle ;controlID= Class, ClassNN, Instance ;Title here is empty when I check it with AutoIt Info ControlClick("", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Class of the window ControlClick("[ScreenKeyboard::SKFrame]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Handle of the window ControlClick("[0x000907A0]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[INSTANCE:18]", "left", "1", "230","890") Am I coding it correctly?
      Thanks
    • By danusko
      Hi, 
      I have autoit program on my computer only portable version. I use Autoit vs 3.1.1.68
      I want to use WinGetTitle but it always return 0. 
      I want to use it for retriev windows title and then i want to switch between windows. 
      E.g. - On start is msgbox where is info - "now choose yourt first window", i click first win - e.g. Excel, then 2. msgbox "now choose your 2. window" and i choose e.g. window folder. Then i want, that my script will switch between this windws and make my routine. 
      But my test code for retrieve win title still return 0. I try this on comp in work. I dont have admin rights but i belive, that this is not a reason, bacause Au3.SPY, show me win title correctly. 
      This is my sample code. 
      Pls. any suggestions?
      thx a lot
      Sleep( 2000 ) ; Allows switching to some other window to see if can get its title. $title = WinGetTitle("[active]") If $title Then MsgBox(0, "", $title) Else MsgBox(0, "", "nothing") EndIf  
    • By MaximusCZ
      Hello, and apologies if this have been discussed before, but I googled and couldnt find anything relevant.
      I have a problem where I try to send a control clink into to a window. 
      Part of window I try to send clicks to looks like this . The black border is showing when I mouse over it Au3Info, I get following information:

      I am testing its interaction with code

      The result I get is that it makes control clicks trough first line, opens and closes menus, as expected.
      When It gets to second line, it does not click a single icon. I can tell that coords are correct as the dropdown menus (No view active) gets focused(altough not rolled out). Same behaviour happens if roughly 40<y<60, so I know I am hitting good height. You can look at how it behaves here: output.webm 
      Dropdown 1 focuses at around 8 sec mark, and 13 sec mark it changes to second dropdown, defocusing first one, seemingly not registering any clinks inbetween.
       
      Have you ever encountered similar behaviour? I need to click the Key button, first on second line, with controlclick (or any other way not hijacking the mouse). I cant trigger that button by keyboard and There is no other control having control over it.
      Help
       
×
×
  • Create New...