KlemsonGuy Posted February 24, 2006 Share Posted February 24, 2006 I'm writing a script that will go through an Internet Explorer web page, and when you click on a particular button, a message alert box comes up. Is there a way to make it automatically click OK without using the MouseClick command? I was hoping for some way to intergrate the IE.au3 UDF's into this. Does anyone know of a way? Link to comment Share on other sites More sharing options...
Valuater Posted February 24, 2006 Share Posted February 24, 2006 try... Send("{ENTER}") 8) Link to comment Share on other sites More sharing options...
KlemsonGuy Posted February 24, 2006 Author Share Posted February 24, 2006 (edited) Ha... would that it were that easy. I may be new to this, but I'm not that new. Yeah, I've tried that, and I also tried putting a delay before it (just in case I was sending the enter command before the message actually popped up), and it still didn't work. Any other advice? try...Send("{ENTER}")8) Edited February 24, 2006 by KlemsonGuy Link to comment Share on other sites More sharing options...
Valuater Posted February 24, 2006 Share Posted February 24, 2006 (edited) IE.au3 to the rescue!!! see Dale Hohm's IE.au3 Library ( its really good ) then get my IE.au3 Builder ( in my sig ) 8) Edited February 24, 2006 by Valuater Link to comment Share on other sites More sharing options...
KlemsonGuy Posted February 24, 2006 Author Share Posted February 24, 2006 Well, that's just it, I have both, and don't get me wrong, they work great, but I just can't figure out how to interface with a javascript alert. Do you know of a way using IE.au3? Link to comment Share on other sites More sharing options...
Fur Posted February 24, 2006 Share Posted February 24, 2006 Two methods I've used: #1 You CAN use Send() to close these, the trick is you have to send the window a TAB first. If WinExists("Microsoft Internet Explorer", "") Then WinActivate("Microsoft Internet Explorer", "") Send("{TAB}{ENTER}") Endif #2 Sometimes (depending on the webpage) you can just bypass the javascript code popping it up in the first place. Don't forget you can actually modify the javascript of a webpage on the fly with this! Feel the power!! Say there is some special code in the onclick event for an image link, part of the code is what pops up the alert box. You can just write your own code and substitute it!! A lot of sites it is very easy to do malicious things because they trust no one is going to monkey with their javascript. Not sure how much longer that will last... ; replace their javascript code with my own! tricky! $img.parentNode.setAttribute("onclick", "return 1") Link to comment Share on other sites More sharing options...
DaleHohm Posted February 24, 2006 Share Posted February 24, 2006 I agree with everything stated so far. I will add however that a Javascript alert may actually cause your AutoIt script to stall until the alert is processed. In this case you actually need to use the SEND command to generate a keystroke that performs the action htat results in the alert box appearing... your script can then continue to run and you are free to process the alert with other AutoIt code. There is an example of this in reply 3 (the examples reply) of the IE.au3 thread. 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 More sharing options...
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