plastix Posted November 23, 2006 Share Posted November 23, 2006 Hi all,Automating a form submission, and have got it working nicely (inc. INPUT type="file") using focus etc... I had 2 methods of entering data into the 'file' field...$ffield = _IEFormElementGetObjByName ($oForm, "file") _IEAction($ffield, "focus") Send($file) ;$file contains path to file While 1 _IEAction($ffield, "focus") $infile = _IEFormElementGetValue ($ffield) If $infile = $file Then ExitLoop Sleep(100) WEndOf course, they both work while IE is visible, but if I use _IECreate with visible = 0, then focus no longer appears to work. Is there any workaround, otherwise I will keep visible.TIA as everPS- thanks again DaleHohm for this library Link to comment Share on other sites More sharing options...
mikehunt114 Posted November 23, 2006 Share Posted November 23, 2006 You can either use ControlSend, or more appropriately, _IEFormElementSetValue. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
DaleHohm Posted November 23, 2006 Share Posted November 23, 2006 _IEFormElementSetValue won't work on INPUT TYPE=file fields due to security restrictions imposed by the browser. As Mike points out, I believe that ControlSend should work. Give focus to the element, then use ControlSend -- the control name to use is "Internet Explorer_Server1". 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...
mikehunt114 Posted November 23, 2006 Share Posted November 23, 2006 Good thing Dale is around to point out the things I don't know IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
DaleHohm Posted November 23, 2006 Share Posted November 23, 2006 Learn and share Mike, learn and share. Thanks for jumping in. 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...
plastix Posted November 23, 2006 Author Share Posted November 23, 2006 Thanks DaleHohm.With IE visible, all methods - including ControlSend - work. However, when IE is invisible, it still appears to fail...ControlFocus("","","Internet Explorer_Server1") ControlSend("","","Internet Explorer_Server1",$file,1)I must be missing something.Using XP Home SP2 IE6SP2 Link to comment Share on other sites More sharing options...
mikehunt114 Posted November 23, 2006 Share Posted November 23, 2006 (edited) Try: ControlFocus("Microsoft Internet Explorer","","Internet Explorer_Server1") ControlSend("Microsoft Internet Explorer","","Internet Explorer_Server1",$file,1) oÝ÷ Ùú+ N®«ªljëh×6 _IEAction($ffield, "focus") ControlSend("Microsoft Internet Explorer","","Internet Explorer_Server1",$file,1) ;Or _IEAction($ffield, "focus") ControlSend("Microsoft Internet Explorer","","",$file,1) Hopefully one of those works for you. Edited November 23, 2006 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted November 23, 2006 Moderators Share Posted November 23, 2006 The most fail safe way is to use the hwnd of the IE window. Here is a good example of how to accomplish this.ImageShack Upload Link to comment Share on other sites More sharing options...
plastix Posted November 23, 2006 Author Share Posted November 23, 2006 @big_daddy - thanks. that works. Thanks to all for your help & guideance 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