here's some sample code
Code:
TestNewHotkey:
COM_init()
COM_CoInitialize()
;COM_Error(0)
GotIt = 0
DetectHiddenText, On
GoSub, COMInitializeTest
WinGet, AHKSite_ID, ID, AutoHotkey
WinGetTitle, AutoHotkey, ahk_id %AHKSite_ID%
AHKWeb = ahk_id %AHKSite_ID%
WinWait, %AHKWeb%
IfWinNotActive, %AHKWeb%, ,WinActivate, %AHKWeb%
WinWaitActive, %AHKWeb%
Sleep, 1000
COM_Invoke(iWebBrowser2, "Document.parentWindow.execScript", "window.dialogArguments.getElementsByTagName('input').item[2].focus()") ;focus in search box
Sleep, 500
COM_Invoke(iWebBrowser2, "Document.parentWindow.execScript", "window.dialogArguments.getElementsByTagName('input').item[3].focus()") ;focus on first search button
Sleep, 500
COM_Invoke(iWebBrowser2, "Document.parentWindow.execScript", "window.dialogArguments.getElementsByTagName('input').item[4].focus()") ;focus on second search button
COM_CoUnInitialize()
COM_Term()
Return
COMInitializeTest:
GotIt=0
COM_init()
COM_CoInitialize()
website := "http://www.autohotkey.com"
SearchTestSiteAgain:
psh := COM_CreateObject("Shell.Application")
psw := COM_Invoke(psh, "Windows") ; note this captures windows explorer windows as well
Loop, % COM_Invoke(psw, "Count")
{
LocationURL := COM_Invoke(psw,"Item[" A_Index-1 "].LocationURL")
IfInString, LocationURL,%website%
{
GotIt=1
iWebBrowser2 := COM_Invoke(psw,"Item",A_Index-1)
break
}
Else
{
GotIt=0
}
}
COM_Release(psw), VarSetCapacity(psw, 0), COM_Release(psh), VarSetCapacity(psh, 0)
TryAgain_GetTestSite:
if(GotIt=0)
{
iWebBrowser2 := COM_CreateObject("InternetExplorer.Application")
COM_Invoke(iWebBrowser2 , "Visible", "True")
; this is an optional first part of code
;open a page
COM_Invoke(iWebBrowser2,"Navigate","http://www.autohotkey.com")
; make sure the page has loaded
loop 80 ; sets limit if itenerations to 40 seconds 80*500=40000=40 secs
{
Sleep,500 ; sleep half second between cycles
If (rdy2:=COM_Invoke(iWebBrowser2,"readyState")) = 4
break ; break the loop the page has loaded
}
GoTo, SearchTestSiteAgain
}
Else
{
COM_Invoke(iWebBrowser2, "Document.parentWindow.execScript", "window.showModalDialog('http://www.google.com','','')")
}
RETURN
I get a javascript error but thats minor...I think the code above might act wierd it might not do anything unless you close the modal window after its opened, if it does that can just do
Code:
javascript:window.showModalDialog('http://www.google.com','','')
I can't seem to get into that modal window to do anything....