Sign in to follow this  
Followers 0
peppe124

Internet Explorer Modal Windows

17 posts in this topic

Hello everybody

I've got a problem using an Internet Explorer Modal window.

Inside the page I'm working on, there's an image (no id or name assigned to it) which is actually a link to a javascript function that open a Modal window.

To get the handler I've tried using both _IETagNameGetCollection and _IEImgClick and they actually open the window.

But after that, it seems the program get stuck! Just to make an example I've put a simply msgbox but it doesn't appear!

On the other hand, if I activate that window by mousemove, it is not stuck and the other lines are runned as usual.

Can somebody help me with this strange behaviour??

Thank you so much

Share this post


Link to post
Share on other sites



Not sure if i follow you correctly but i think you need to use _IEAtach() on that window.

Check out the help file examples.

Share this post


Link to post
Share on other sites

Not sure if i follow you correctly but i think you need to use _IEAtach() on that window.

Check out the help file examples.

Thx for your reply.

I'll try to explain the problem better.

When I click the image and the window is opened, none of the following instructions is executed!

It's like AutoIt is waiting for something. Indeed, If I close that window, it resume working again.

As I said, the problem doesn't exist if I activate the link by "mousemove"(But I don't want to use it)

So the problem is not how to acces to that window, it's actually how to activate the link without being stuck.

Hope it's more clear now.

Thank you

Share this post


Link to post
Share on other sites

Show me your code.

I guess you have to return control or _IEAttach to the initial window.

Share this post


Link to post
Share on other sites

Show me your code.

I guess you have to return control or _IEAttach to the initial window.

Here it is.

_IEImgClick ($oForm, "/CCB/Estinzioni/images/carte_credito.gif","src",0,0) <-I click the image searching for src

Send("{SPACE}") <-- That it's the operation I have to do(in order to select a radiobutton), but it doesn't work

ConsoleWrite("click")<-- it doesn't work neither.

Share this post


Link to post
Share on other sites

Thought so - the Send command is sending to your new window.

Replace that with ControlSend or with some of the IE functions from the IE UDF

like _IEFormElementRadioSelect or something like that.

Share this post


Link to post
Share on other sites

Thought so - the Send command is sending to your new window.

Replace that with ControlSend or with some of the IE functions from the IE UDF

like _IEFormElementRadioSelect or something like that.

I'm afraid you didn't understand well.

The instructions after the imgclick are ignored...like it is paused.

So whatever I put there none of them are considered, until I close the window.

(but that's no good since I have to send commands to that window).

Share this post


Link to post
Share on other sites

Please post full script.

Put a msgbox right after the _IEImgClick.

Do you get any errors in SCITE console?

Do you have any error handlers?

Share this post


Link to post
Share on other sites

sure...

$oFrame = _IEFrameGetObjByName($oIE, "mainIFrame")

$oFrame1 = _IEFrameGetObjByName($oFrame, "esito")

$oForm = _IEFormGetObjByName($oFrame1, "formEsito")

IEImgClick ($oForm, "/CCB/Estinzioni/images/image1.gif","src",0,0) ->AFTER HERE, IT OPEN THE WINDOW,THEN PAUSES

if (@error>0) Then

ConsoleWrite("error")

EndIf

ConsoleWrite("click")->IT is ignored till I close the modal window

Hope it can help

Share this post


Link to post
Share on other sites

Please see the second example for _IEAction in the helpfile.

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

Share this post


Link to post
Share on other sites

it's exactly what I did during my earlier experiment, but it doesn't work (the window is not opened this way)

Indeed, I thought I couldn't give focus to a image

;THE IMAGE DOESN'T HAVE AN ID OR NAME, SO I HAVE TO FIND IT THIS WAY

$oInputs = _IETagNameGetCollection($oForm, "IMG")

if (@error>0) Then

ConsoleWrite("error" )

EndIf

For $oInput In $oInputs

;consoleWrite($oInput.src ) ;### Debug Console

If (StringInStr($oInput.src, "immage1.gif")) Then

consoleWrite($oInput.src )

_IEAction($oInput, "focus")

ControlSend($oInput, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")

send("{Enter}")

ExitLoop

EndIf

Next

Share this post


Link to post
Share on other sites

I think you are missing something.

When you click on the image , a new window opens right?

And you want to select a radiobutton on the NEW window right?

Then you need to use _IEAttach to get the new window object and then use IEfunctions to do it.

Share this post


Link to post
Share on other sites

I think you are missing something.

When you click on the image , a new window opens right?

And you want to select a radiobutton on the NEW window right?

Then you need to use _IEAttach to get the new window object and then use IEfunctions to do it.

Right, it does open and I do want to select a radiobutton, but as soon as I open this NEW window (Through imgclick or directly using the handler), it stucks, like when you have a winwait or something like that!

So even if I put IEAttach or whatever, it won't work, see?

This situation doesn't happen If I open the window using the mouse (mousemove) but I don't wan't to rely on it.

Share this post


Link to post
Share on other sites

Sorry, I posted the wrong code. That's the correct one (still not working):

$oInputs = _IETagNameGetCollection($oForm, "IMG")

if (@error>0) Then

ConsoleWrite("ERROR" )

EndIf

For $oInput In $oInputs

;consoleWrite($oInput.src ) ;### Debug Console

If (StringInStr($oInput.src, "Image1.gif")) Then

consoleWrite($oInput.src )

$hwnd = _IEPropertyGet($oIE, "hwnd")

_IEAction($oInput, "focus")

controlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")

ExitLoop

EndIf

Next

Share this post


Link to post
Share on other sites

You said this image click forks :

$oFrame = _IEFrameGetObjByName($oIE, "mainIFrame")
$oFrame1 = _IEFrameGetObjByName($oFrame, "esito")
$oForm = _IEFormGetObjByName($oFrame1, "formEsito")
IEImgClick ($oForm, "/CCB/Estinzioni/images/image1.gif","src",0,0) ->AFTER HERE, IT OPEN THE WINDOW,THEN PAUSES
if (@error>0) Then
ConsoleWrite("error")
EndIf

ConsoleWrite("click")->IT is ignored till I close the modal window

Hope it can help

Change it a little bit:

$oFrame = _IEFrameGetObjByName($oIE, "mainIFrame")

$oFrame1 = _IEFrameGetObjByName($oFrame, "esito")

$oForm = _IEFormGetObjByName($oFrame1, "formEsito")

_IEImgClick ($oForm, "/CCB/Estinzioni/images/image1.gif","src",0,0) ->AFTER HERE, IT OPEN THE WINDOW,THEN PAUSES

if (@error>0) Then

ConsoleWrite("error")

EndIf

_IEAtach("check how it is done from the example to attach to the new window")

ConsoleWrite("click")

Share this post


Link to post
Share on other sites

Thank you.

I've tried, but it's not working yet.

I have the same problem.

It seems that I lose the control as soon as I activate the image :huggles: .

Why doesn't the focus example(you know focus+controlsend(enter)) work with this image??

:D

Share this post


Link to post
Share on other sites

Do you lose control after the focus action perhaps? if so, you may need to use _IEPropertyGet to get the coordinates of the image and MouseMove to move the pointer. If a COM action results in the modal dialog, control will not be returned to your code until it is dismissed. You need to use standard AutoIt controls outside of COM and the DOM to prevent losing it.

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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0