g00001
2021-02-25 15:19:13 +08:00
写了几句 aardio 代码,可以监控到所有 Chromium 内核浏览器地址栏的变动( 包含 edge )
import win.ui;
/*DSG{{*/
var winform = win.form(text="获取 Chrome,Edge 当前浏览的网址";right=759;bottom=469)
winform.add(
edit={cls="edit";left=20;top=19;right=735;bottom=437;edge=1;multiline=1;z=1}
)
/*}}*/
import winex;
import winex.accObject;
var chromeWidget = {}
var findChromeUrl = function(){
for hwnd in winex.each( "Chrome_WidgetWin_1" ) {
if(!chromeWidget[hwnd]){
var accObject = winex.accObject.fromWindow(hwnd)
if(accObject){
chromeWidget[hwnd] = {
accEdit = accObject.find(role="editable text";state="focusable");
}
}
}
var chrome = chromeWidget[hwnd];
if(chrome){
if(chrome.accEdit){
var url = chrome.accEdit.value();
if( url != chrome.lastUrl ){
winform.edit.print(url);
chrome.lastUrl = url;
}
}
}
}
}
winform.setInterval(2000,findChromeUrl);
winform.show();
win.loopMessage();