thetwistedpanda Posted May 18, 2007 Share Posted May 18, 2007 (edited) Ive been working on a small program to help automate a certain process for www.facebook.com known as poking. I wrote a previous program to help get the automation down and it basically consisted of opening a new IE window, tabbing over to the poke button, and sending enter. This wasnt very effective, however, as there were too many variables to account for, so I decided to embed an IE window into a GUI, and thus this problem arose. Ill post the code below and try to bolden the problem areas, but to summarize; a button is stealing the focus away from my embedded IE window. I cant (or rather, dont want to) send a mouse click to gain the focus back. If any of you fine coders know of a way to select the poke button without having to send tab keys and an enter, I would be greatly appreciative, but I couldnt find a way to do it (without moving the mouse, which isnt really acceptable). The below code isn't finished, but in its current state it can function and poke (if there wasn't a focus problem). < removed > Thanks. Edited May 18, 2007 by thetwistedpanda Link to comment Share on other sites More sharing options...
DaleHohm Posted May 18, 2007 Share Posted May 18, 2007 If I understand it properly, if you replaced your SEND commands of Tabs and Enter with an _IEAction - "click" on your Poke button, you wouldn't have to worry about focus... 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...
thetwistedpanda Posted May 18, 2007 Author Share Posted May 18, 2007 (edited) I tried using an _IEAction but I didn't know how to access the button's information. I'll post the html for it below...;<form method="post" action="poke.php">;<input type="hidden" id="post_form_id" name="post_form_id" value="7c456ca4a2125856b9e41c774aa5119d" />;<input type="hidden" id="id" name="id" value="<removed>" />;<input type="hidden" id="confirmed" name="confirmed" value="1" /><div class="formbuttons">;<input type="submit" value="Poke" onclick="this.disabled=true; this.form.submit();" class="inputsubmit"/>;<input type="button" class="inputbutton" onclick="java script:history.back();" id="cancel" name="cancel" value="Cancel" /></div>I think the bold one is the one I need to click, but as I said, I didn't know how to get to it using autoit. Edited May 18, 2007 by thetwistedpanda Link to comment Share on other sites More sharing options...
DaleHohm Posted May 18, 2007 Share Posted May 18, 2007 Since the form has no name, use _IEFormGetCollection to get a reference to the form and then _IEFormElementGetCollection to get a reference to the input field. If this is the first form on the page it would be: $oForm = _IEFormGetCollection($oIE, 0) ; the first form by 0-based index $oSubmit = _IEFormElementGetCollection($oForm, 3) ; the 4th form element _IEAction($oSubmit, "click") 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...
thetwistedpanda Posted May 18, 2007 Author Share Posted May 18, 2007 Thanks Dale, I got it working now. Sure is a lot more effective then having to tab/enter over xD. 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