Code:
#include COM.ahk
#include GetWebBrowser.ahk
#NoEnv
^d::
Com_Init()
pie := GetWebBrowser()
gUrl := COM_Invoke(pie, "LocationURL")
StringTrimRight, gUrl, gUrl, 1
StringGetPos, SlashPos, gUrl, /, R1
if SlashPos between 6 and 7
return
SplitPath, gUrl,, gUrl
Com_Invoke(pie, "Navigate", gUrl)
Com_Term()
Works for me in IE7. Uses COM and Sean's GetWebBrowser function.
Edit: made less bad.
Edit for explanation:
Sean's COM is here:
http://www.autohotkey.com/forum/viewtopic.php?t=22923Sean's getwebbrowser function is this:
Code:
GetWebBrowser()
{
ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, ahk_class IEFrame
If Not hIESvr
Return
DllCall("SendMessageTimeout", "Uint", hIESvr, "Uint", DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT"), "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 1000, "UintP", lResult)
DllCall("oleacc\ObjectFromLresult", "Uint", lResult, "Uint", COM_GUID4String(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}"), "int", 0, "UintP", pdoc)
IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}"
pweb := COM_QueryService(pdoc,IID_IWebBrowserApp,IID_IWebBrowserApp)
COM_Release(pdoc)
Return pweb
}
(which i have saved to its own ahk file)
Good luck!