mouse-only: drag&drop the link to an empty space on the tab-ribbon; or
mouse-only with this simple script running: which enabled us to drag&drop the link just a small step "up" (instead of dragging it all the way to the tab-ribbon) to make the subject matter happen.
Code: Select all
#IfWinActive, ahk_exe msedge.exe
~LButton::keyLButton()
keyLButton() {
WinGetPos,,, ww,, A
MouseGetPos, x, y
If not ((v := GetFocusedElement().Value) = GetURL("A")) and SubStr(v, 1, 8) = "https://"
If (x < ww - 25) and (y > 80) and GetKeyState(A_ThisHotkey, "P")
{ Sleep, 500
MouseGetPos, xx, yy
If (Abs(yy - y) > 22 or Abs(xx - x) > 15) and GetKeyState(A_ThisHotkey, "P")
MouseMove, ww - 171, 20
}
}
GetFocusedElement() { ;based on the script by Descolada (https://www.autohotkey.com/boards/viewtopic.php?p=459451&sid=dde6b407875aadff59bc35e0864f63e4#p459451)
IUIAutomation := ComObjCreate(CLSID_CUIAutomation := "{ff48dba4-60ef-4201-aa87-54103eef594e}", IID_IUIAutomation := "{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}")
DllCall(NumGet(NumGet(IUIAutomation+0)+8*A_PtrSize), "ptr",IUIAutomation, "ptr*",element) ;IUIAutomation::GetFocusedElement
DllCall(NumGet(NumGet(element+0)+23*A_PtrSize), "ptr", element, "ptr*", name) ;IUIAutomationElement::CurrentName
DllCall(NumGet(NumGet(element+0)+10*A_PtrSize), "ptr", element, "uint",30045, "ptr", (VarSetCapacity(val,8+2*A_PtrSize)+NumPut(0,val,0,"short")+NumPut(0,val,8,"ptr"))*0+&val) ;IUIAutomationElement::GetCurrentPropertyValue
ObjRelease(element)
ObjRelease(IUIAutomation)
Return {"Name":StrGet(name,"utf-16"), "Value":StrGet(NumGet(val,8,"ptr"),"utf-16")}
}
GetURL(wTitle*) { ;written by Descolada (https://www.autohotkey.com/boards/viewtopic.php?p=459451&sid=dde6b407875aadff59bc35e0864f63e4#p459451)
ErrorLevel := 0
if !(wId := WinExist(wTitle*)) {
ErrorLevel := 1
return
}
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*", elementMain) ; IUIAutomation::ElementFromHandle
NumPut(addressbarStrPtr := DllCall("oleaut32\SysAllocString", "wstr", "Address and search bar", "ptr"),(VarSetCapacity(addressbar,8+2*A_PtrSize)+NumPut(8,addressbar,0,"short"))*0+&addressbar,8,"ptr")
DllCall("oleaut32\SysFreeString", "ptr", addressbarStrPtr)
if (A_PtrSize = 4) {
DllCall(NumGet(NumGet(IUIAutomation+0)+23*A_PtrSize), "ptr", IUIAutomation, "int", 30005, "int64", NumGet(addressbar, 0, "int64"), "int64", NumGet(addressbar, 8, "int64"), "ptr*", addressbarCondition) ; IUIAutomation::CreatePropertyCondition
} else {
DllCall(NumGet(NumGet(IUIAutomation+0)+23*A_PtrSize), "ptr", IUIAutomation, "int", 30005, "ptr", &addressbar, "ptr*", addressbarCondition) ; IUIAutomation::CreatePropertyCondition
}
DllCall(NumGet(NumGet(elementMain+0)+5*A_PtrSize), "ptr", elementMain, "int", TreeScope_Descendants := 0x4, "ptr", addressbarCondition, "ptr*", currentURLElement) ; IUIAutomationElement::FindFirst
DllCall(NumGet(NumGet(currentURLElement+0)+10*A_PtrSize),"ptr",currentURLElement,"uint",30045,"ptr",(VarSetCapacity(currentURL,8+2*A_PtrSize)+NumPut(0,currentURL,0,"short")+NumPut(0,currentURL,8,"ptr"))*0+¤tURL) ;IUIAutomationElement::GetCurrentPropertyValue
ObjRelease(currentURLElement)
ObjRelease(elementMain)
ObjRelease(IUIAutomation)
If (theText := StrGet(NumGet(currentURL,8,"ptr"),"utf-16")) = "// // LOGGED"
Return "_Logged_"
return theText
}
2022may28 edited: improved the script, avoided the known drawback. and from now on, not only "up", any directions will do the job.