get-windows
get-windows copied to clipboard
need to get browser's active tab url for windows and linux
can anyone help me to add this feature
i need this too, can anyone help?
Same here
I would love to have this functionality too. Can someone point us to the right direction?
Does someone got success on Mac as I tried but on Mac I don’t even get the URLs as mentioned in description.
On Mon, 1 Jun 2020 at 3:18 PM, John Caesar Patac [email protected] wrote:
I would love to have this functionality too. Can someone point us to the right direction?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sindresorhus/active-win/issues/64#issuecomment-636746988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWQG4HNV7QNXPUZ5FTBTULRUN2PHANCNFSM4KZCLYCQ .
-- Sent from Gmail iPhone App
it works for me on a mac. would need it to be working on windows/linux as well too. Any idea whats the issue?
No idea, but documentation already described its not working on windows and Linux. I saw the code and it’s for Mac only but somehow at my Mac machine it was not working.
I found privacy settings I think I have to permit that to grab the url on Mac. Will update you if that’s working.
On Thu, 4 Jun 2020 at 12:55 PM, hansel [email protected] wrote:
it works for me on a mac. would need it to be working on windows/linux as well too. Any idea whats the issue?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sindresorhus/active-win/issues/64#issuecomment-638657956, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWQG4GEVI6N6VGRCR4VFWDRU5D5VANCNFSM4KZCLYCQ .
-- Sent from Gmail iPhone App
is it working on windows and linux ???
There is a tool written in Go that can parse the active browser tab's URL from Chrome's session files: https://github.com/lemnos/chrome-session-dump
Presumably, this tool could be bundled within active-win, or its parsing code ported to NodeJS. This should work on both Windows and Linux. It might even work with all Chromium-based browsers.
I tested it on Linux already. Unfortunately, I don't have the time to do a PR currently. So, if anyone with some Go experience wants to take a look ;)
Hello
You can use UI Automation in Windows
Example my code in c++ for chrome
// MathLibrary.cpp : Defines the exported functions for the DLL.
#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include <AtlBase.h>
#include <UIAutomation.h>
#include <comutil.h>
#include "Chrome.h"
#pragma comment(lib, "comsuppw.lib")
BSTR chrome_geturl(HWND hwnd) {
CoInitialize(NULL);
CComBSTR empty(L"");
BSTR r = empty;
while (true)
{
if (!hwnd)
break;
if (!IsWindowVisible(hwnd))
continue;
CComQIPtr<IUIAutomation> uia;
if (FAILED(uia.CoCreateInstance(CLSID_CUIAutomation)) || !uia)
break;
CComPtr<IUIAutomationElement> root;
if (FAILED(uia->ElementFromHandle(hwnd, &root)) || !root)
break;
CComPtr<IUIAutomationCondition> condition;
//URL's id is 0xC354, or use UIA_EditControlTypeId for 1st edit box
uia->CreatePropertyCondition(UIA_ControlTypePropertyId,
CComVariant(0xC354), &condition);
//or use edit control's name instead
//uia->CreatePropertyCondition(UIA_NamePropertyId,
// CComVariant(L"Address and search bar"), &condition);
CComPtr<IUIAutomationElement> edit;
if (FAILED(root->FindFirst(TreeScope_Descendants, condition, &edit))
|| !edit)
break; //maybe we don't have the right tab, continue...
CComVariant url;
if (FAILED(edit->GetCurrentPropertyValue(UIA_ValueValuePropertyId, &url)))
break;
r = url.bstrVal;
break;
}
CoUninitialize();
return (_bstr_t)r;
};
BSTR getChromeUrl(HWND hwnd)
{
BSTR r = chrome_geturl(hwnd);
return r;
}
Does anyone have a solution for URLs on windows?
One option is to use browser extensions to append the URL to the window title, then parse it after retrieving it from active win.
same issue with windows 11 url is missing