Page 1 of 1

Chrome focus address bar bug.

Posted: 31 Jul 2018, 23:04
by Mike__
Hello,

Anyone can tell me why sometime AHK does not focus on Chrome address bar?
If I add a loop with the below code, most of the time it work but sometime it does not focus...

Code: Select all

Pathx = %A_Scriptdir%\URL.xlsx

Xl := ComObjCreate("Excel.Application") 				        ;create a handle to a new excel application
Xl_Workbook := Xl.Workbooks.Open(Pathx) 			;open an existing file
code:= ThisRow[8] ; variable that we look into the excel file for the url
x := xl.Range("A:A").Find(code).row
found := xl.Range("B" x).text

sleep, 150
WinActivate, ahk_exe chrome.exe
sleep, 250
Send ^l ; this is the shortcut for focusing on the address bar
Sleep 500 ; give just a bit of time for Chrome to respond
Clipboard := Found ; url found in the excel file
Send ^v ; paste url into the address bar
sleep, 250
Send, {ENTER}

msgbox, this is a message to stop the loop and verify if it really focus each time.

Xl_Workbook.Close(0)                                                            ;closes but does not save 
Xl.quit()



Re: Chrome focus address bar bug.

Posted: 01 Aug 2018, 09:41
by YoucefHam
try using "F6" key

send, {F6}