Jump to content

Recommended Posts

Posted

Hello, I have a window created by web page. This new window is a Internet Explorer_TridentDlgFrame Class. I need to get text from it but i tried unsuccessiful. I try with

WinGetText(...) and with ControlGetText but the return text is null. Have idea?

Thanks and sorry for my english

Posted (edited)

That window was opened from a web page by Javascript window.showModalDialog. I think its internals are JS, not IE DOM or WinAPI, so I don't know that AutoIt can do anything with it.

:huggles:

Edit: Wrong again... :D

Javascript is not the issue. This opens Microsoft's demo and pops the modal dialog:

#include <IE.au3>

; Open Microsoft's demo page
$sURL = "http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialogLaunch.htm"
$oIE = _IECreate($sURL, True)
$hIE = _IEPropertyGet($oIE, "hwnd")
ConsoleWrite("$hIE = " & $hIE & @LF)

; Click button to open modal popup
$oButton = _IETagNameGetCollection($oIE, "Button", 0)
If @error = 0 And IsObj($oButton) Then _IEAction($oButton, "Click")
Sleep(2000)

And then you can run this to get the modal dialog itself:

#include <IE.au3>

; Check out popup
$oPopup = _IEAttach("Text Selection in a Modal Dialog -- Webpage Dialog", "DialogBox")
$sHTML = _IEDocReadHTML($oPopup)
ConsoleWrite($sHTML & @LF)

It's two separate scripts, because the _IEAction() is blocking. This version works around that by not making a COM call to click the button, so the script isn't blocked:

#include <IE.au3>

; Open Microsoft's demo page
$sURL = "http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialogLaunch.htm"
$oIE = _IECreate($sURL, True)
$hIE = _IEPropertyGet($oIE, "hwnd")
ConsoleWrite("$hIE = " & $hIE & @LF)

; Click button to open modal popup
$oButton = _IETagNameGetCollection($oIE, "Button", 0)
If @error = 0 And IsObj($oButton) Then _IEAction($oButton, "focus")
ControlSend($hIE, "", "", "{ENTER}")
Sleep(2000)

; Check out popup
$oPopup = _IEAttach("Text Selection in a Modal Dialog -- Webpage Dialog", "DialogBox")
$sHTML = _IEDocReadHTML($oPopup)
ConsoleWrite($sHTML & @LF)
$oTable = _IETableGetCollection($oPopup, 0)
$aData = _IETableWriteToArray($oTable, True)
_ArrayDisplay($aData, "$aData")

:-)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

Your example work. But my script don't work :-(

I tried to attach to my web dialog page and autoit return this error:

The requested action with this object has failed.:

Return $oIE.document.parentwindow

Return $oIE.Document^ ERROR

My web dialog page is right click unabled and I cannot select test.

Please ...Help me!

Posted

You'll have to post some code so we can see what you were trying to do when it failed.

:D

$oPopup = _IEAttach("Accesso -- Finestra di dialogo pagina Web", "DialogBox")

$sHTML = _IEDocReadHTML($oPopup)

msgbox(0,"",$sHTML )

Thanks

Posted

You'll have to either explain your trouble and the steps you have toake and the specific results you've encountered OR you'lll need to create a reproducer (see my sig).

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...