have enabled screen reader support too - no dice..Descolada wrote: ↑26 Jun 2023, 23:13@newcod3r, in the chrome://accessibility/ site try checking "Screen reader support". Also make sure that when you run the GetURL function that the Chrome browser is at least partially visible - otherwise UIA methods won't work. Also, what is the ErrorLevel after the function? Try running this and output the result:Code: Select all
WinActivate, % "ahk_exe chrome.exe" WinWaitActive, % "ahk_exe chrome.exe",, 1 MsgBox % GetUrl("ahk_exe chrome.exe") "`nErrorLevel: " ErrorLevel GetUrl(wTitle:="ahk_exe chrome.exe") { ErrorLevel := 0 if !(wId := WinExist(wTitle)) { ErrorLevel := 1 return } try ControlGet, cHwnd, Hwnd,, Chrome_RenderWidgetHostHWND1, ahk_id %wId% if !cHwnd { ErrorLevel := 2 return } SendMessage, WM_GETOBJECT := 0x003D, 0, 1, , ahk_id %cHwnd% IUIAutomation := ComObjCreate(CLSID_CUIAutomation := "{ff48dba4-60ef-4201-aa87-54103eef594e}", IID_IUIAutomation := "{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}") DllCall(NumGet(NumGet(IUIAutomation+0)+6*A_PtrSize), "ptr", IUIAutomation, "ptr", cHwnd, "ptr*", documentEl) ; IUIAutomation::ElementFromHandle DllCall(NumGet(NumGet(documentEl+0)+10*A_PtrSize),"ptr",documentEl,"uint",30045,"ptr",(VarSetCapacity(currentURL,8+2*A_PtrSize)+NumPut(0,currentURL,0,"short")+NumPut(0,currentURL,8,"ptr"))*0+¤tURL) ;IUIAutomationElement::GetCurrentPropertyValue ObjRelease(documentEl) ObjRelease(IUIAutomation) sUrl := StrGet(NumGet(currentURL,8,"ptr"),"utf-16") DllCall("oleaut32\SysFreeString", "ptr", currentURL) If !sUrl { ;empty ErrorLevel := 3 return } return sUrl }
Get the URL of the current (active) browser tab
Re: Get the URL of the current (active) browser tab
Re: Get the URL of the current (active) browser tab
@newcod3r, but I see the messagebox you posted shows the URL of the page? What are you expecting to see?
Re: Get the URL of the current (active) browser tab
Sometimes I need to trigger it multiple times in order for the URL to be captured, even though there's already Winactivate at the start.. not sure why?
I used it like this previously and it worked, but not sure why it stopped executing based on what URL I'm on:
Code: Select all
url := GetUrl("ahk_exe chrome.exe") ; ChatGPT Commands
If InStr(url, "chat.openai.com") {
::rew::Rewrite this in the style of
}
If InStr(url, "instagram.com") {
:X:z::SendInput n
}
return
Re: Get the URL of the current (active) browser tab
@newcod3r
use "web address in title" addon
use "web address in title" addon
Re: Get the URL of the current (active) browser tab
sorry I don't understand what you mean?
Re: Get the URL of the current (active) browser tab
@newcod3r, I don't understand how the example code you provided could ever have worked as you intended, because as far as I know you can't use hotstrings inside normal if-else statements.
I tested with this and it worked fine (only in Chrome of course):
I tested with this and it worked fine (only in Chrome of course):
Code: Select all
GetUrl(wTitle:="ahk_exe chrome.exe") {
ErrorLevel := 0
if !(wId := WinExist(wTitle)) {
ErrorLevel := 1
return
}
try ControlGet, cHwnd, Hwnd,, Chrome_RenderWidgetHostHWND1, ahk_id %wId%
if !cHwnd {
ErrorLevel := 2
return
}
SendMessage, WM_GETOBJECT := 0x003D, 0, 1, , ahk_id %cHwnd%
IUIAutomation := ComObjCreate(CLSID_CUIAutomation := "{ff48dba4-60ef-4201-aa87-54103eef594e}", IID_IUIAutomation := "{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}")
DllCall(NumGet(NumGet(IUIAutomation+0)+6*A_PtrSize), "ptr", IUIAutomation, "ptr", cHwnd, "ptr*", documentEl) ; IUIAutomation::ElementFromHandle
DllCall(NumGet(NumGet(documentEl+0)+10*A_PtrSize),"ptr",documentEl,"uint",30045,"ptr",(VarSetCapacity(currentURL,8+2*A_PtrSize)+NumPut(0,currentURL,0,"short")+NumPut(0,currentURL,8,"ptr"))*0+¤tURL) ;IUIAutomationElement::GetCurrentPropertyValue
ObjRelease(documentEl)
ObjRelease(IUIAutomation)
sUrl := StrGet(NumGet(currentURL,8,"ptr"),"utf-16")
DllCall("oleaut32\SysFreeString", "ptr", currentURL)
If !sUrl { ;empty
ErrorLevel := 3
return
}
return sUrl
}
IsPageActive(url, wTitle:="ahk_exe chrome.exe") {
static lastTitle := "", lastUrl := ""
if !WinActive(wTitle)
return 0
WinGetTitle, currentTitle, %wTitle%
if (!lastTitle || currentTitle != lastTitle) {
currentUrl := GetUrl(wTitle)
lastUrl := currentUrl, lastTitle := currentTitle
}
if (lastUrl == "")
return 0
return InStr(lastUrl, url)
}
#If IsPageActive("chat.openai.com")
::rew::Rewrite this in the style of
#If IsPageActive("instagram.com")
::sth::Something else
Re: Get the URL of the current (active) browser tab
I also don't understand - my code worked for a long time until recently. Have been using this method for domain specific actions:Descolada wrote: ↑28 Jun 2023, 10:09@newcod3r, I don't understand how the example code you provided could ever have worked as you intended, because as far as I know you can't use hotstrings inside normal if-else statements.
I tested with this and it worked fine (only in Chrome of course):Code: Select all
GetUrl(wTitle:="ahk_exe chrome.exe") { ErrorLevel := 0 if !(wId := WinExist(wTitle)) { ErrorLevel := 1 return } try ControlGet, cHwnd, Hwnd,, Chrome_RenderWidgetHostHWND1, ahk_id %wId% if !cHwnd { ErrorLevel := 2 return } SendMessage, WM_GETOBJECT := 0x003D, 0, 1, , ahk_id %cHwnd% IUIAutomation := ComObjCreate(CLSID_CUIAutomation := "{ff48dba4-60ef-4201-aa87-54103eef594e}", IID_IUIAutomation := "{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}") DllCall(NumGet(NumGet(IUIAutomation+0)+6*A_PtrSize), "ptr", IUIAutomation, "ptr", cHwnd, "ptr*", documentEl) ; IUIAutomation::ElementFromHandle DllCall(NumGet(NumGet(documentEl+0)+10*A_PtrSize),"ptr",documentEl,"uint",30045,"ptr",(VarSetCapacity(currentURL,8+2*A_PtrSize)+NumPut(0,currentURL,0,"short")+NumPut(0,currentURL,8,"ptr"))*0+¤tURL) ;IUIAutomationElement::GetCurrentPropertyValue ObjRelease(documentEl) ObjRelease(IUIAutomation) sUrl := StrGet(NumGet(currentURL,8,"ptr"),"utf-16") DllCall("oleaut32\SysFreeString", "ptr", currentURL) If !sUrl { ;empty ErrorLevel := 3 return } return sUrl } IsPageActive(url, wTitle:="ahk_exe chrome.exe") { static lastTitle := "", lastUrl := "" if !WinActive(wTitle) return 0 WinGetTitle, currentTitle, %wTitle% if (!lastTitle || currentTitle != lastTitle) { currentUrl := GetUrl(wTitle) lastUrl := currentUrl, lastTitle := currentTitle } if (lastUrl == "") return 0 return InStr(lastUrl, url) } #If IsPageActive("chat.openai.com") ::rew::Rewrite this in the style of #If IsPageActive("instagram.com") ::sth::Something else
Code: Select all
^s:: ; Domain Specific Actions
url := GetURL()
if ( InStr(url, "autohotkey.com") || InStr(url, "outlook") )
ChromeClick("Submit")
return
Re: Get the URL of the current (active) browser tab
Hi there,Descolada wrote: ↑28 Jun 2023, 10:09@newcod3r, I don't understand how the example code you provided could ever have worked as you intended, because as far as I know you can't use hotstrings inside normal if-else statements.
I tested with this and it worked fine (only in Chrome of course):Code: Select all
GetUrl(wTitle:="ahk_exe chrome.exe") { ErrorLevel := 0 if !(wId := WinExist(wTitle)) { ErrorLevel := 1 return } try ControlGet, cHwnd, Hwnd,, Chrome_RenderWidgetHostHWND1, ahk_id %wId% if !cHwnd { ErrorLevel := 2 return } SendMessage, WM_GETOBJECT := 0x003D, 0, 1, , ahk_id %cHwnd% IUIAutomation := ComObjCreate(CLSID_CUIAutomation := "{ff48dba4-60ef-4201-aa87-54103eef594e}", IID_IUIAutomation := "{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}") DllCall(NumGet(NumGet(IUIAutomation+0)+6*A_PtrSize), "ptr", IUIAutomation, "ptr", cHwnd, "ptr*", documentEl) ; IUIAutomation::ElementFromHandle DllCall(NumGet(NumGet(documentEl+0)+10*A_PtrSize),"ptr",documentEl,"uint",30045,"ptr",(VarSetCapacity(currentURL,8+2*A_PtrSize)+NumPut(0,currentURL,0,"short")+NumPut(0,currentURL,8,"ptr"))*0+¤tURL) ;IUIAutomationElement::GetCurrentPropertyValue ObjRelease(documentEl) ObjRelease(IUIAutomation) sUrl := StrGet(NumGet(currentURL,8,"ptr"),"utf-16") DllCall("oleaut32\SysFreeString", "ptr", currentURL) If !sUrl { ;empty ErrorLevel := 3 return } return sUrl } IsPageActive(url, wTitle:="ahk_exe chrome.exe") { static lastTitle := "", lastUrl := "" if !WinActive(wTitle) return 0 WinGetTitle, currentTitle, %wTitle% if (!lastTitle || currentTitle != lastTitle) { currentUrl := GetUrl(wTitle) lastUrl := currentUrl, lastTitle := currentTitle } if (lastUrl == "") return 0 return InStr(lastUrl, url) } #If IsPageActive("chat.openai.com") ::rew::Rewrite this in the style of #If IsPageActive("instagram.com") ::sth::Something else
I used this code for awhile now, and realized it only works intermittently. able to advise why? Thank you so much.
Re: Get the URL of the current (active) browser tab
@deets, it seems for some reason sometimes Chrome "forgets" it's content control and it goes blank. I rewrote the function to find the Document element instead, which seems to be more reliable. Also I added logic to clear the hotstring matching when Ctrl+A is followed by a backspace.
Though at this point you might prefer to use one of anonymous1184 GetUrl functions instead
Code: Select all
global HostringAllSelected := 0
GetUrl(wTitle:="ahk_exe chrome.exe") {
ErrorLevel := 0
if !(wId := WinExist(wTitle)) {
ErrorLevel := 1
return
}
try ControlGet, cHwnd, Hwnd,, Chrome_RenderWidgetHostHWND1, ahk_id %wId%
if !cHwnd {
ErrorLevel := 2
return
}
SendMessage, WM_GETOBJECT := 0x003D, 0, 1, , ahk_id %cHwnd%
IUIAutomation := ComObjCreate(CLSID_CUIAutomation := "{ff48dba4-60ef-4201-aa87-54103eef594e}", IID_IUIAutomation := "{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}")
DllCall(NumGet(NumGet(IUIAutomation+0)+6*A_PtrSize), "ptr", IUIAutomation, "ptr", wId, "ptr*", winElement) ; IUIAutomation::ElementFromHandle
VarSetCapacity(value, 8 + 2 * A_PtrSize, 0)
NumPut(3, value, 0, "UShort")
NumPut(50030, value, 8, "Ptr")
if (A_PtrSize = 8) {
DllCall(NumGet(NumGet(IUIAutomation + 0) + 23 * A_PtrSize), "Ptr", IUIAutomation, "UInt", 30003, "Ptr", &value, "Ptr*", documentCondition)
} else {
DllCall(NumGet(NumGet(IUIAutomation + 0) + 23 * A_PtrSize), "Ptr", IUIAutomation, "UInt", 30003, "UInt64", NumGet(value, 0, "UInt64"), "UInt64", NumGet(value, 8, "UInt64"), "Ptr*", documentCondition)
}
DllCall(NumGet(NumGet(winElement + 0) + 5 * A_PtrSize), "Ptr", winElement, "UInt", 4, "Ptr", documentCondition, "Ptr*", documentElement)
DllCall(NumGet(NumGet(documentElement+0)+10*A_PtrSize),"ptr",documentElement,"uint",30045,"ptr",(VarSetCapacity(currentURL,8+2*A_PtrSize)+NumPut(0,currentURL,0,"short")+NumPut(0,currentURL,8,"ptr"))*0+¤tURL) ;IUIAutomationElement::GetCurrentPropertyValue
sUrl := StrGet(NumGet(currentURL,8,"ptr"),"utf-16")
ObjRelease(documentCondition)
ObjRelease(documentElement)
ObjRelease(IUIAutomation)
DllCall("oleaut32\SysFreeString", "ptr", currentURL)
If !sUrl { ;empty
ErrorLevel := 3
return
}
return sUrl
}
IsPageActive(url, wTitle:="ahk_exe chrome.exe") {
static lastTitle := "", lastUrl := ""
if !WinActive(wTitle)
return 0
WinGetTitle, currentTitle, %wTitle%
if (!lastTitle || currentTitle != lastTitle) {
lastUrl := GetUrl(wTitle), lastTitle := currentTitle
}
if (lastUrl == "")
return 0
return InStr(lastUrl, url)
}
~^a::
HostringAllSelected := 1
return
~Left::
~Right::
~Up::
~Down::
~Tab::
~LButton::
HostringAllSelected := 0
return
~Backspace::
if (HostringAllSelected)
Hotstring("Reset")
return
~^v::Hotstring("Reset")
#If IsPageActive("chat.openai.com")
::rew::Rewrite this in the style of
#If IsPageActive("instagram.com")
::sth::Something else
Re: Get the URL of the current (active) browser tab
I'm afraid this was a while ago and I don't remember the error. The bottom line is that I learned the code well enough to customize it heavily and now it works 99% of the time. I have it ignore the other 1%. Perhaps I could fix that 1%, but I don't mind it enough to do so. I've been running it like this ever since that post.
Re: Get the URL of the current (active) browser tab
I tried this code a few weeks ago and now it doesn't return the URL as expected. Any advice please? Thank you.Descolada wrote: ↑16 Jul 2023, 08:08@deets, it seems for some reason sometimes Chrome "forgets" it's content control and it goes blank. I rewrote the function to find the Document element instead, which seems to be more reliable. Also I added logic to clear the hotstring matching when Ctrl+A is followed by a backspace.Though at this point you might prefer to use one of anonymous1184 GetUrl functions insteadCode: Select all
global HostringAllSelected := 0 GetUrl(wTitle:="ahk_exe chrome.exe") { ErrorLevel := 0 if !(wId := WinExist(wTitle)) { ErrorLevel := 1 return } try ControlGet, cHwnd, Hwnd,, Chrome_RenderWidgetHostHWND1, ahk_id %wId% if !cHwnd { ErrorLevel := 2 return } SendMessage, WM_GETOBJECT := 0x003D, 0, 1, , ahk_id %cHwnd% IUIAutomation := ComObjCreate(CLSID_CUIAutomation := "{ff48dba4-60ef-4201-aa87-54103eef594e}", IID_IUIAutomation := "{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}") DllCall(NumGet(NumGet(IUIAutomation+0)+6*A_PtrSize), "ptr", IUIAutomation, "ptr", wId, "ptr*", winElement) ; IUIAutomation::ElementFromHandle VarSetCapacity(value, 8 + 2 * A_PtrSize, 0) NumPut(3, value, 0, "UShort") NumPut(50030, value, 8, "Ptr") if (A_PtrSize = 8) { DllCall(NumGet(NumGet(IUIAutomation + 0) + 23 * A_PtrSize), "Ptr", IUIAutomation, "UInt", 30003, "Ptr", &value, "Ptr*", documentCondition) } else { DllCall(NumGet(NumGet(IUIAutomation + 0) + 23 * A_PtrSize), "Ptr", IUIAutomation, "UInt", 30003, "UInt64", NumGet(value, 0, "UInt64"), "UInt64", NumGet(value, 8, "UInt64"), "Ptr*", documentCondition) } DllCall(NumGet(NumGet(winElement + 0) + 5 * A_PtrSize), "Ptr", winElement, "UInt", 4, "Ptr", documentCondition, "Ptr*", documentElement) DllCall(NumGet(NumGet(documentElement+0)+10*A_PtrSize),"ptr",documentElement,"uint",30045,"ptr",(VarSetCapacity(currentURL,8+2*A_PtrSize)+NumPut(0,currentURL,0,"short")+NumPut(0,currentURL,8,"ptr"))*0+¤tURL) ;IUIAutomationElement::GetCurrentPropertyValue sUrl := StrGet(NumGet(currentURL,8,"ptr"),"utf-16") ObjRelease(documentCondition) ObjRelease(documentElement) ObjRelease(IUIAutomation) DllCall("oleaut32\SysFreeString", "ptr", currentURL) If !sUrl { ;empty ErrorLevel := 3 return } return sUrl } IsPageActive(url, wTitle:="ahk_exe chrome.exe") { static lastTitle := "", lastUrl := "" if !WinActive(wTitle) return 0 WinGetTitle, currentTitle, %wTitle% if (!lastTitle || currentTitle != lastTitle) { lastUrl := GetUrl(wTitle), lastTitle := currentTitle } if (lastUrl == "") return 0 return InStr(lastUrl, url) } ~^a:: HostringAllSelected := 1 return ~Left:: ~Right:: ~Up:: ~Down:: ~Tab:: ~LButton:: HostringAllSelected := 0 return ~Backspace:: if (HostringAllSelected) Hotstring("Reset") return ~^v::Hotstring("Reset") #If IsPageActive("chat.openai.com") ::rew::Rewrite this in the style of #If IsPageActive("instagram.com") ::sth::Something else
Re: Get the URL of the current (active) browser tab
@newcod3r, yeah I've had the same problem and I'm not exactly sure what they've changed. I think it's the same problem as before: for some reason sometimes Chrome "forgets" it's content control. Before it automatically "woke up" when the window was activated/focused, but now it appears to require ControlFocus, Chrome_RenderWidgetHostHWND1, % "ahk_exe chrome.exe". After using that line even once, it seems to fix the problem for a while.
If you don't have a problem with Chrome being activated every time, you could add the line ControlFocus, Chrome_RenderWidgetHostHWND1, % wTitle as the first line of GetUrl. Or perhaps use a helper function such as
If you don't have a problem with Chrome being activated every time, you could add the line ControlFocus, Chrome_RenderWidgetHostHWND1, % wTitle as the first line of GetUrl. Or perhaps use a helper function such as
Code: Select all
GetUrlActivate(wTitle) {
result := GetUrl(wTitle)
if !result
ControlFocus, Chrome_RenderWidgetHostHWND1, % wTitle
return GetUrl(wTitle)
}
Re: Get the URL of the current (active) browser tab
ah it seems to be broken again recently.. any advice?Descolada wrote: ↑17 Aug 2023, 00:22@newcod3r, yeah I've had the same problem and I'm not exactly sure what they've changed. I think it's the same problem as before: for some reason sometimes Chrome "forgets" it's content control. Before it automatically "woke up" when the window was activated/focused, but now it appears to require ControlFocus, Chrome_RenderWidgetHostHWND1, % "ahk_exe chrome.exe". After using that line even once, it seems to fix the problem for a while.
If you don't have a problem with Chrome being activated every time, you could add the line ControlFocus, Chrome_RenderWidgetHostHWND1, % wTitle as the first line of GetUrl. Or perhaps use a helper function such asCode: Select all
GetUrlActivate(wTitle) { result := GetUrl(wTitle) if !result ControlFocus, Chrome_RenderWidgetHostHWND1, % wTitle return GetUrl(wTitle) }
Re: Get the URL of the current (active) browser tab
@newcod3r, apparently now the title "ahk_exe chrome.exe" sometimes matches some kind of empty-titled window which gives an incorrect UIAutomation element. After changing all instances of "ahk_exe chrome.exe" to "Google Chrome ahk_exe chrome.exe" and using SetTitleMatchMode 2 it appeared to start working again.
I've also written a method for AHK v2 using the UIA-v2 library if anyone is interested. Also gets the Chrome URL if Chrome window isn't active or is behind other windows.
I've also written a method for AHK v2 using the UIA-v2 library if anyone is interested. Also gets the Chrome URL if Chrome window isn't active or is behind other windows.
Code: Select all
#include UIA.ahk
global HotstringAllSelected := 0
~^a::global HotstringAllSelected := 1
~Left::
~Right::
~Up::
~Down::
~Tab::
~LButton::global HotstringAllSelected := 0
~Backspace::
{
if (HotstringAllSelected)
Hotstring("Reset")
}
~^v::Hotstring("Reset")
#HotIf IsPageActive("chat.openai.com")
::rew::Rewrite this in the style of
#HotIf IsPageActive("instagram.com")
::sth::Something else
IsPageActive(url, WinTitle:="Google Chrome ahk_exe chrome.exe") {
static lastTitle := "", lastUrl := ""
if !WinActive(WinTitle)
return 0
currentTitle := WinGetTitle(WinTitle)
if (!lastTitle || currentTitle != lastTitle) {
lastUrl := ChromeGetURL(WinTitle), lastTitle := currentTitle
}
if (lastUrl == "")
return 0
return InStr(lastUrl, url)
}
ChromeGetURL(WinTitle := "Google Chrome ahk_exe chrome.exe") {
static cache := Map()
if !(hWnd := WinExist(WinTitle))
throw TargetError("No matching Chrome window found", -1)
if !(chWnd := ActivateChromiumAccessibility(WinTitle))
throw TargetError("Unable to find Chrome content element!", -1)
if !cache.Has(chWnd) {
try cache[chWnd] := UIA.ElementFromHandle(chWnd)
catch
throw TargetError("Failed to get the document element", -1)
for k in [cache*]
if !WinExist(k)
cache.Delete(k)
}
try return cache[chWnd].Value
}
ActivateChromiumAccessibility(WinTitle := "Google Chrome ahk_exe chrome.exe") {
static SWP_NOREDRAW := 0x0008, SWP_NOSIZE := 0x0001, SWP_NOMOVE := 0x0002, SWP_NOACTIVATE := 0x0010
hWnd := IsInteger(WinTitle) ? WinTitle : WinExist(WinTitle)
if !IsWindowVisible() || !(cHwnd := TryGetChromiumHwnd()) {
list := WinGetList(), index := 0
for i, win in list
if win = hWnd {
index := i
break
}
active := WinExist("A")
tp := WinGetTransparent(hWnd)
prevDelay := A_WinDelay
SetWinDelay -1
WinSetTransparent(0, hWnd)
; Bring to front
DllCall("SetWindowPos", "ptr", hWnd, "ptr", 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW)
WinActivate(hWnd)
WinActivate(active)
end := A_TickCount + 100
while (A_TickCount < end && !(cHwnd := TryGetChromiumHwnd()))
Sleep -1
if index > 1
DllCall("SetWindowPos", "ptr", hWnd, "ptr", list[index-1], "int", 0, "int", 0, "int", 0, "int", 0, "int", SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOACTIVATE)
WinSetTransparent(tp, hWnd)
SetWinDelay prevDelay
}
return chWnd
TryGetChromiumHwnd() {
try return ControlGetHwnd("Chrome_RenderWidgetHostHWND1", hWnd)
return 0
}
IsWindowVisible() {
WinGetPosEx(hWnd, &x, &y, &w, &h)
l := Max(0, x), t := Max(0, y), r := Min(x+w-1, A_ScreenWidth), b := Min(y+h-1, A_ScreenHeight)
if !(hWnd = UIA.WindowFromPoint(l, t) || hWnd = UIA.WindowFromPoint(r, t) || hWnd = UIA.WindowFromPoint(l, b) || hWnd = UIA.WindowFromPoint(r, b))
return 0
return 1
}
; https://www.autohotkey.com/boards/viewtopic.php?t=114183&p=508461
WinGetPosEx(hWindow, &X := "", &Y := "", &W := "", &H := "") {
static S_OK := 0x0, DWMWA_EXTENDED_FRAME_BOUNDS := 9
RECTPlus := Buffer(24,0)
try {
DWMRC := DllCall("dwmapi\DwmGetWindowAttribute",
"Ptr", hWindow, ;-- hwnd
"UInt", DWMWA_EXTENDED_FRAME_BOUNDS, ;-- dwAttribute
"Ptr", RECTPlus, ;-- pvAttribute
"UInt", 16, ;-- cbAttribute
"UInt")
} catch
return False
X := NumGet(RECTPlus, 0, "Int"), Y := NumGet(RECTPlus, 4, "Int")
, R := NumGet(RECTPlus, 8, "Int"), B := NumGet(RECTPlus, 12, "Int")
, W := R - X, H := B - Y
}
}
Re: Get the URL of the current (active) browser tab
hmm I updated the window title to "Google Chrome ahk_exe chrome.exe" but it's still not working. I'm on v1 by the way.
Re: Get the URL of the current (active) browser tab
Greetings Antonio! Do you know how to make it work on Arc browser? (arc.net)
Thank you!
Thank you!
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: docterry and 118 guests