Sign in to follow this  
Followers 0
Syruz

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

32 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Sometimes, Send TAB or Alt-TAB then send ENTER

8)


NEWHeader1.png

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Anybody with help?

Share this post


Link to post
Share on other sites

Anybody with help?

need your code to help any further

8)


NEWHeader1.png

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

just a test to see, that way you shou know for sure if it stopped

Func continue($img)
    $img2 = StringStripWS($item, 8)
    _IEImgClick($o_IE, $imglink & $img2 & ".gif", "src", 0, 0) 
MsgBox(0x0, "Test", "Scrit is running", 5)
EndFunc

I use msgbox() often for testing

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Ya, i've used that and no message box pops up.

Share this post


Link to post
Share on other sites

Change the INFO in the topic to mention IE.au3 help. I am sure Daleor big daddy or someone will come along and help you!

they are the IE pros

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Could you post the link to the site? Or maybe a screenshot of the popup... some more info.. this is a weird problem :S

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Use WinWait and are you 100% sure that thts the EXACT title.

Share this post


Link to post
Share on other sites

Ya, for now my resolution is to open another script which simply sleeps then presses enter.

Share this post


Link to post
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

Share this post


Link to post
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!!!!!!!

Share this post


Link to post
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

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