I needed this feature and I've seen there was no solution which worked reliably in Firefox and Opera (I don't use IE, I assume there is some COM solution for it)
Unfortunately there is no COM interface to the afore mentioned browsers thus no AHK COM solution to be had
Thank you keyboardfreak this has been many times asked for and is the best idea I have seen but it as you mentioned isnt an ahk solution but a Grease Monkey/Javascript Solution. Albeit a pretty darn good one
I think once Firefox exposes its internal methods and properties to other languages other than mozilla plug in based then the move from IE to mozilla in the corp world can finally begin. But not untill then
another interesting solution I found is
<!-- m -->
http://www.autohotke... ... it firefox<!-- m -->
this is for Mozilla Firefox:
;-- from AUTOWQ german forum
;-- http://de.autohotkey.com/forum/topic29.html
#Persistent
UR=http://www.screamer-radio.com/
SC=Screamer ;title
IE=%A_programfiles%\Mozilla Firefox\firefox.exe
CL=ahk_class MozillaWindowClass
Run,%IE% %UR%,,max
WinWait,%SC%
IfWinNotActive,%SC%,,WinActivate,%SC%
WinWaitActive,%SC%
Sleep,300
SetTimer,FireFoxLoadDetect,500
Return
FireFoxLoadDetect: ;check firefox rotary wheel
col32:=0xB2B2B2
col16:=0xB5B2B5
WinGetPos,,,WI,HI,A
;---Firefox 1.5 / 2.0 ------
Wi -= 16 ; Position from wheel = Windowswidth -16
PixelGetColor, OutputVar, Wi, 41 ; 41 = Position from top
if outputvar in %col16%,%col32%
{
msgbox,%UR% is open
ExitApp
}
return
As far as COM IE and Gui Browsers go
<!-- m -->
http://www.autohotke... ... highlight=<!-- m -->
The above link is a complete COM IE Gui Browser tutorial
This is just an excerpt the first 2 snippets do not standalone but the 3rd one that I got from Sean does
wait for it to finish loading
loop
If (rdy:=COM_Invoke(pwb,"readyState") = 4)
break
another way to check if a page has loaded using javascript via compwin:=COM_Invoke(doc:=COM_Invoke(pwb,"Document"),"parentWindow")
if pwin is integer
loop
If rdy:=COM_Invoke(pwin, "execScript","var rdy=document.readyState","rdy") = "complete"
break
of course always release objects not textyou wouldnt release rdy but you would release doc in the example above
a comletely independent way to check readystate requires tab if enabled to be the selected tab but doesnt require the window to be active
<!-- m -->http://www.autohotke... ... sc&start=0<!-- m -->
It'll check whether a webpage is completely loaded or not in the active Internet Explorer.
NEED the latest COM Standard Library.
; Run, iexplore.exe http://www.google.com/
MsgBox, % IEReady()
Return
IEReady(hIESvr = 0)
{
If Not hIESvr
{
Loop, 50
{
ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, A ; ahk_class IEFrame
If hIESvr
Break
Else Sleep 100
}
If Not hIESvr
Return """Internet Explorer_Server"" Not Found."
}
Else
{
WinGetClass, sClass, ahk_id %hIESvr%
If Not sClass == "Internet Explorer_Server"
Return "The specified control is not ""Internet Explorer_Server""."
}
COM_Init()
If 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)=0
&& pdoc && pweb:=COM_QueryService(pdoc,IID_IWebBrowserApp:="{0002DF05-0000-0000-C000-000000000046}")
Loop
If COM_Invoke(pweb, "ReadyState") = 4
Break
Else Sleep 500
COM_Release(pdoc)
COM_Release(pweb)
COM_Term()
Return pweb ? "DONE!" : False
}