Syruz Posted October 21, 2007 Posted October 21, 2007 (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 October 21, 2007 by Syruz
Valuater Posted October 21, 2007 Posted October 21, 2007 Sometimes, Send TAB or Alt-TAB then send ENTER 8)
ahaning Posted October 21, 2007 Posted October 21, 2007 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.
Syruz Posted October 21, 2007 Author Posted October 21, 2007 (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 October 21, 2007 by Syruz
Valuater Posted October 21, 2007 Posted October 21, 2007 Anybody with help?need your code to help any further8)
Syruz Posted October 21, 2007 Author Posted October 21, 2007 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
Valuater Posted October 21, 2007 Posted October 21, 2007 (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 October 21, 2007 by Valuater
Syruz Posted October 21, 2007 Author Posted October 21, 2007 (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 October 21, 2007 by Syruz
Valuater Posted October 21, 2007 Posted October 21, 2007 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)
Syruz Posted October 21, 2007 Author Posted October 21, 2007 Ya, i've used that and no message box pops up.
Valuater Posted October 21, 2007 Posted October 21, 2007 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 pros8)
Nahuel Posted October 21, 2007 Posted October 21, 2007 Could you post the link to the site? Or maybe a screenshot of the popup... some more info.. this is a weird problem :S
Valuater Posted October 21, 2007 Posted October 21, 2007 Previous similar requestshttp://www.autoitscript.com/forum/index.ph...st&p=153894http://www.autoitscript.com/forum/index.ph...st&p=231592http://www.autoitscript.com/forum/index.ph...st&p=210403It depends on the kind of propblem you are having.most can be easily handled while others need a seperate script or Adlib() to handle that box8)
Syruz Posted October 21, 2007 Author Posted October 21, 2007 (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 October 21, 2007 by Syruz
Thatsgreat2345 Posted October 21, 2007 Posted October 21, 2007 Use WinWait and are you 100% sure that thts the EXACT title.
Syruz Posted October 21, 2007 Author Posted October 21, 2007 Ya, for now my resolution is to open another script which simply sleeps then presses enter.
DaleHohm Posted October 23, 2007 Posted October 23, 2007 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
dmt740 Posted October 26, 2007 Posted October 26, 2007 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!!!!!!!
DaleHohm Posted October 26, 2007 Posted October 26, 2007 Please see the second example for _IEAction. Also, see here: http://www.autoitscript.com/forum/index.ph...trolsend++enterDale 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now