Jump to content

Recommended Posts

Posted

I have tried a few different ways to click and activate Google Chrome Version 79.0.3945.88 (Official Build) (64-bit) but for some reason it won't activate the web page. I know this should work because it will click and activate Internet Explorer or any other window I have open but this doesn't click on a Chrome web page to activate it and make it the focus. 

#include <AutoItConstants.au3>

$click = MouseClick("left",14, 165,2,5) ; should activate the window but to make sure I'll check the return

if $click <> 1 Then MsgBox(0,"","It didn't click")

;still didn't work so add this line maybe it will activate it

MouseDown($MOUSE_CLICK_LEFT) ;nope still no good

Anyone have an idea of what I'm doing wrong? 

 

Posted

Have you tried WinActivate?  The code above isn't specific to Chrome, you're basically just clicking x/y coords, although I have tested the code and it worked fine for me, activating Chrome window.

  • Moderators
Posted

@bigbry2k3 What exactly are you trying to do in Chrome? There are a couple of UDFs, such as WebDriver and UIAutomation, that will make things much easier for you than point and click. If you could elaborate on what you're trying to accomplish, we can make better suggestions.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted
;whatever .....

$title="Has Chrome Created A Way To Block Clicks? - AutoIt General Help and Support - AutoIt Forums - Google Chrome"


if WinExists($title)=1 Then
$Handle=WinGetHandle($title)
WinActivate($Handle)
WinSetState($Handle, "", @SW_MAXIMIZE)
WinSetOnTop($Handle,'',1)
Else
    WindowDoesntExist()

EndIf


Func WindowDoesntExist()
    Run(@ProgramFilesDir & "\Google\Chrome\Application\chrome.exe")  ;your directory may vary
    $HwD=WinWait("[CLASS:Chrome_WidgetWin_1]")
    WinActivate($HwD)
    WinSetOnTop($HwD,'',1)
    WinSetState($HwD,'', @SW_MAXIMIZE)

;the cursor should be in the address bar so type in whereever you want to go....
sleep(500)
Send("https://www.autoitscript.com/forum/topic/201204-has-chrome-created-a-way-to-block-clicks/")
Sleep(200)

Send("{ENTER}")

EndFunc

 

Posted

If you want to open a url with Chrome just use:

;~ Get location of Chrome.exe
Global $g_sGoogleChrome = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Chrome.exe", "")
    If FileExists($g_sGoogleChrome) = 0 Then Exit
Run($g_sGoogleChrome & " https://www.autoitscript.com/forum/topic/201204-has-chrome-created-a-way-to-block-click")

 

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
×
×
  • Create New...