GodandRock Posted August 15, 2006 Share Posted August 15, 2006 Ok I'm very very frustrated trying to make this work. I don't know whats wrong! Look at this script. $oIE = _IE_Example ("form") $o_form = _IEFormGetObjByName($oIE, "ExampleForm") $o_file = _IEFormElementGetObjByName($o_form, "fileExample") _IEFormElementSetValue($o_file, "test") What this is supposed to do is set the value "test" to the browse file area. But for some damn reason it stays blank! Please help me out! [font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font] Link to comment Share on other sites More sharing options...
DaleHohm Posted August 15, 2006 Share Posted August 15, 2006 Unfortunately it is a security restriction in the browser -- you cannot script INPUT TYPE=FILE elements. I had a documentation update submitted to explain this, but it missed the release some how -- we'll get it in soon. Here is what will be added to help: Note: You cannot use _IEFormElementSetValue to set the value of an INPUT TYPE=FILE element. Browser security restrictions prevent this element from being scripted. See the example below for a workaround. ; ******************************************************* ; Example 4 - Set the value of an INPUT TYPE=FILE element ; (security restrictions prevent using _IEFormElementSetValue) ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example("form") $oForm = _IEFormGetObjByName($oIE, "ExampleForm") $oInputFile = _IEFormElementGetObjByName($oForm, "fileExample") ; Assign input focus to the field and then send the text string _IEAction($oInputFile, "focus") Send("C:\myfile.txt") 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...
GodandRock Posted August 16, 2006 Author Share Posted August 16, 2006 Wow thanks for clearing that up...I spent like 2 hours going "WTF?!". Ok now one more question. Is "Send()" reliable for this? Can we still do the Send when IE is created in hidden mode? Will my own typing change the Element value? And is there an alternative for Send that is similar to ControlSetText or something? Please help me answer those questions! And thanks a lot DaleHohm, you've helped me out a lot. [font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font] Link to comment Share on other sites More sharing options...
DaleHohm Posted August 16, 2006 Share Posted August 16, 2006 Yes, you can use ControlSend instead of Send. ControlSend(_IEPropertyGet($oIE, "hwnd"), "", "", "Your Text") 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...
GodandRock Posted August 16, 2006 Author Share Posted August 16, 2006 Ok ty a lot. If there are any other ways you can enter text into file types or any other special notes, please state them and add them to the helpfile in the next update. Ty. [font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font] Link to comment Share on other sites More sharing options...
GodandRock Posted August 16, 2006 Author Share Posted August 16, 2006 Ok the ControlSend isn't working...What do I put in the ControlID parameter? Please help out. I'de rather not use Send, its not that efficient. [font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font] Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted August 16, 2006 Moderators Share Posted August 16, 2006 Ok the ControlSend isn't working...What do I put in the ControlID parameter? Please help out. I'de rather not use Send, its not that efficient.Try this: $sText = "Your text" $HWnd = _IEPropertyGet($oIE, "hwnd") ControlSend ( $HWnd, "", "Internet Explorer_Server1", $sText) Link to comment Share on other sites More sharing options...
GodandRock Posted August 16, 2006 Author Share Posted August 16, 2006 That isn't working either. How does "Internet Explorer_Server1" let AutoIt know that I'm trying to enter text into the FileType? Help please. [font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font] Link to comment Share on other sites More sharing options...
DaleHohm Posted August 16, 2006 Share Posted August 16, 2006 You have to give it focus first... see example above: _IEAction($oInputFile, "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...
GodandRock Posted August 16, 2006 Author Share Posted August 16, 2006 OK I got it! Ty. [font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font] 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