Jump to content

Send("{Enter}") - Won't send... IE.au3 help!


Syruz
 Share

Recommended Posts

I'm automating Internet Explorer. My script clicks an image which brings up a dialog box. Which I then want the Enter key to be sent so it presses ok. However, when the dialog box comes up, my script stops. How can I get it to send the Enter key even with the dialog box open?

Edited by Syruz
Link to comment
Share on other sites

I'm automating Internet Explorer. My script clicks an image which brings up a dialog box. Which I then want the Enter key to be sent so it presses ok. However, when the dialog box comes up, my script stops. How can I get it to send the Enter key even with the dialog box open?

You might need to make use of WinWaitActive() so that your script pauses between clicking the image and then pressing Enter to get rid of the dialog box.

So you'd do...

*click image*

WinWaitActive("Title", "Window text")

Send("{Enter}")

Another idea would be to send {Space} since pressing the space bar will do the same thing to an active button that pressing Enter will do, but it is less likely to do things in the off chance that some other window (ex: CMD) is active.

Link to comment
Share on other sites

It's not that it sends the enter too fast, or not at the right time. My script just stops when the dialog box opens, none of my script continues while the dialog box is open...If i close it it then sends the enter key...its really weird.

Edit: No code whatsoever executes after the dialog window opens?

Edited by Syruz
Link to comment
Share on other sites

Func continue($img)

$img2 = StringStripWS($item, 8)

_IEImgClick($o_IE, $imglink & $img2 & ".gif", "src", 0, 0) ;This works, but then after the dialog box opens with

;an OK and Cancel button, nothing else happens. The script seems to pause and doesn't issue any commands/function

Send("{Enter}")

$o_form = _IEFormGetObjByName($o_IE, "form1")

$o_element = _IEFormElementGetObjByName($o_form, "item")

_IEFormElementSetValue($o_element, $item)

Endfunc

Link to comment
Share on other sites

Thats not much to work with.. did you try my suggestion of using tab then enter???

also

_IEImgClick($o_IE, $imglink & $img2 & ".gif", "src", 0, 0) the last 0 states dont wait for any page load before continuing try this too

_IEImgClick($o_IE, $imglink & $img2 & ".gif", "src", 0, 1)

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Ya i added the 0 after to see any changes, doesn't affect. Also adding Alt + Tab doesn't help because its like the script just pauses... after the imgclick line, whatever code comes afterwards doesn't execute while the dialog box is open. Once it closes (manually), the script continues on.

Edited by Syruz
Link to comment
Share on other sites

I seem to have a similar problem, but I can't have anything after the imgclick bringing focus to anything because no script executes until the javascript popup is dealt with. I'd prefer not to tamper with the javascript, however it is a last resort possibility. And not sure exactly how adlib works... is it just a function that calls itself everyone x amount of time? and will it be able to deal with the javascript? Speed is an issue btw...

Edit: Ok, figured out adlib, and that wont even work...it will work after i close the dialog box, but the script just stops completely while its open...

AdlibEnable("MyAdLib")
_IEImgClick($o_IE, $imglink & $img2 & ".gif", "src", 0, 0)
AdLibDisable()

Func MyAdLib()
       ;Tried with and without the WinExist/WinActivate
    If WinExists("Microsoft Internet Explorer", "") Then
        WinActivate("Microsoft Internet Explorer", "")
        Send("{ENTER}")
    Endif
EndFunc
Edited by Syruz
Link to comment
Share on other sites

Clicks and forms submits and other events can activate Javascript code in a browser that create modal dialog boxes. When this happens, the javascript will prevent control from being returned to your script until the dialog box is processed (In Nebraska, if two trains meet at a crossing, neither can move until the other is gone).

See here for some discussion http://www.autoitscript.com/forum/index.ph...trolsend++enter and the second example with _IEAction in the helpfile for a workaround you can use with buttons, links, images etc.

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

Link to comment
Share on other sites

I seem to have a similar problem, but I can't have anything after the imgclick bringing focus to anything because no script executes until the javascript popup is dealt with. I'd prefer not to tamper with the javascript, however it is a last resort possibility. And not sure exactly how adlib works... is it just a function that calls itself everyone x amount of time? and will it be able to deal with the javascript? Speed is an issue btw...

Edit: Ok, figured out adlib, and that wont even work...it will work after i close the dialog box, but the script just stops completely while its open...

AdlibEnable("MyAdLib")
_IEImgClick($o_IE, $imglink & $img2 & ".gif", "src", 0, 0)
AdLibDisable()

Func MyAdLib()
      ;Tried with and without the WinExist/WinActivate
    If WinExists("Microsoft Internet Explorer", "") Then
        WinActivate("Microsoft Internet Explorer", "")
        Send("{ENTER}")
    Endif
EndFunc
I'm having the same problem with a popup box that I can't get to do anything at all. I have read several suggestions and tried a ton of things but still the same. I am navigating to a page, doing an _IEAction("saveas") and thats where it stops. No matter what I have tried I cant get anything to happen to the save as box. Ive tried enter, tabs + enter, tabs + space, tried mouseclick, I'm out of options. So I leave it in your capable hands... HELP!!!!!!!
Link to comment
Share on other sites

Please see the second example for _IEAction. Also, see here: http://www.autoitscript.com/forum/index.ph...trolsend++enter

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

Link to comment
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
 Share

  • Recently Browsing   0 members

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