 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
frescalus
Joined: 19 Nov 2009 Posts: 42
|
Posted: Thu Nov 19, 2009 5:24 pm Post subject: model window problem |
|
|
Hello,
I'm having a little problem. One of our sites we use has a model window pops up however I'm having a problem getting the controls from that window. I'm not sure what you guys need to help troubleshoot but if you have suggestions or can assist please let me know...
I'm trying to use COM_Invoke to get the controls, edit text boxes, etc when the window pops up...
Anytime I try to retrieve any information from controls or whatnot I get the parent window instead of the child window....
Thanks
EDIT: sorry its a model window, not modeless |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Nov 19, 2009 8:07 pm Post subject: |
|
|
Try obtaining some spy information. IE HTML Element Spy is a good one to use as well.
HTH |
|
| Back to top |
|
 |
frescalus
Joined: 19 Nov 2009 Posts: 42
|
Posted: Wed Nov 25, 2009 1:29 pm Post subject: |
|
|
I use that a lot, I can get all sorts of stuff from the window but when it comes to actually accessing the window I can't do it. Everything I do goes back to the parent window instead I can't get to any of the items in the modal window.
as an example: I'm able to do:
javascript:window.showModalDialog('http://www.google.com','','')
and in autohotkey:
COM_Invoke(iWebBrowser2, "Document.parentWindow.execScript", "window.showModalDialog('http://www.google.com','','')")
but I cannot seem to pass parameters or grab values from the modal window |
|
| Back to top |
|
 |
frescalus
Joined: 19 Nov 2009 Posts: 42
|
Posted: Wed Nov 25, 2009 9:43 pm Post subject: |
|
|
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.... |
|
| Back to top |
|
 |
frescalus
Joined: 19 Nov 2009 Posts: 42
|
Posted: Fri Nov 27, 2009 12:53 pm Post subject: |
|
|
| no one knows? |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2294 Location: Louisville KY USA
|
|
| Back to top |
|
 |
frescalus
Joined: 19 Nov 2009 Posts: 42
|
Posted: Mon Nov 30, 2009 1:16 pm Post subject: |
|
|
2 problems with this so far
1) its running awfully slow activating the window
2) its not sending the commands to the modal window...
it will do the commands for a normal web page though... |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|