Fur Posted November 7, 2005 Share Posted November 7, 2005 Been using Dale's awesome IE.au3 UDF to automate things. I have a form that works via submit when you click a spot on the image. As you are aware, doing so sends the X,Y coordinate the image is clicked as part of the form submission. How do I do this? _IEClickImg() or getting the image object and calling $image.click don't have a means of specifying the coords to pass in to the form. Can this be done through the OLE interface? Cheers Link to comment Share on other sites More sharing options...
DaleHohm Posted November 7, 2005 Share Posted November 7, 2005 I don't know of anything in the click method for specifying coordianates. I look around a bit...Looks to me that .fireEvent is called for... here are some ideas to get you started. I'll assume that your browser is $oIE and the your image map is $oArea$oEvent = $oIE.document.createEventObject() $oEvent.clientX = 50 $oEvent.clientY = 300 $oEvent.cancelBubble = True $oArea.fireEvent("onclick", $oEvent)I haven't tested this, just adapted an example. The coordinates are "relative to the viewable document area"... it may take a lot of playing to get them to be in a reasonable coordinate system.Let me know how you fare.DaleBeen using Dale's awesome IE.au3 UDF to automate things.I have a form that works via submit when you click a spot on the image. As you are aware, doing so sends the X,Y coordinate the image is clicked as part of the form submission. How do I do this? _IEClickImg() or getting the image object and calling $image.click don't have a means of specifying the coords to pass in to the form.Can this be done through the OLE interface?Cheers 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...
Fur Posted November 7, 2005 Author Share Posted November 7, 2005 Well, unfortunately, I've run into another issue. The image doesn't show up as an element in the form! :-( <html><head><title>Test Form</title></head> <body> <form action="http://www.p2pmud.com/form.php" name="testform" method="post"> Input: <input type="text" name="input_value" value="0" size="5" maxlength="8"> <input type="image" src="store10.jpg"> </form> </body> </html> Try to extract it, but there is only one element coming back! #include <IE.au3> ; Create a browser window and navigate to hotmail Global $oIE = _IEAttach("Test Form") if $oIE = 0 Then $oIE = _IECreate() Endif _IENavigate($oIE, "C:\php5\shop.html") Local $o_form = $oIE.document.forms.item(0) Local $elems = $o_form.elements ConsoleWrite("Num elements " & $elems.length & @LF) Exit Link to comment Share on other sites More sharing options...
DaleHohm Posted November 7, 2005 Share Posted November 7, 2005 (edited) I've never been able to find out why, but there are some elements that you would expect to be in the form element collection that are not part of it for some reason. It is aparently implemented inconsistently accross browsers.In this case, you need to select the object from the collection of all document elements using:_IETagNameAllGetCollection($oIE)or_IETagNameGetCollection($oIE, "input")You can then either reference them by item number ( .item($n) ) or you can loop through the collection with a For... In... Next loop and check attributes to find a match (like .src )DaleEdit: fixed typosWell, unfortunately, I've run into another issue. The image doesn't show up as an element in the form! :-(<html><head><title>Test Form</title></head> <body> <form action="http://www.p2pmud.com/form.php" name="testform" method="post"> Input: <input type="text" name="input_value" value="0" size="5" maxlength="8"> <input type="image" src="store10.jpg"> </form> </body> </html>Try to extract it, but there is only one element coming back!#include <IE.au3> ; Create a browser window and navigate to hotmail Global $oIE = _IEAttach("Test Form") if $oIE = 0 Then $oIE = _IECreate() Endif _IENavigate($oIE, "C:\php5\shop.html") Local $o_form = $oIE.document.forms.item(0) Local $elems = $o_form.elements ConsoleWrite("Num elements " & $elems.length & @LF) Exit Edited November 7, 2005 by DaleHohm 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...
Fur Posted November 8, 2005 Author Share Posted November 8, 2005 Thx Dale. Searching over the input tags does work. However, no love on the fireEvent() yet... 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