chariot Posted March 19, 2009 Posted March 19, 2009 Hello I'm newbie in autoit. I have a question about how can I set file path to input file Zbrowser file to upload to website) in IE. for input text I can use _IEPropertySet($name,"innertext","Test") but for input file I'can, and I try to use _IEPropertySet($oFile,"value","D:\pic.jpg") but It's don't work. How can I do?
jvanegmond Posted March 19, 2009 Posted March 19, 2009 This is probably a form element, so use this: _IEFormElementSetValue($oFile, "D:\pic.jpg") github.com/jvanegmond
chariot Posted March 19, 2009 Author Posted March 19, 2009 (edited) Thank you but it doesn't work too. Edited March 19, 2009 by chariot
Stilgar Posted March 19, 2009 Posted March 19, 2009 You can't set (in the most browsers and I "hope" in IE, too) an "input type='file'", because of security reasons. jEdit4AutoIt PlanMaker_UDF
jvanegmond Posted March 19, 2009 Posted March 19, 2009 You can't set (in the most browsers and I "hope" in IE, too) an "input type='file'", because of security reasons.Why would that be a dangerous thing to do? github.com/jvanegmond
Stilgar Posted March 19, 2009 Posted March 19, 2009 (edited) Why would that be a dangerous thing to do?If that would be possible, every script on every page can fill out an input field of this type and can try if it can download any file from your computer. Edited March 19, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF
jvanegmond Posted March 19, 2009 Posted March 19, 2009 (edited) If that would be possible, every script on every page can fill out an input field of this type and can try if it can download any file from your computer.I see. That is important for Javascript, but not for IE COM in my opinion since a process is already running that has access to your hard drive. You are right. In the help file see _IEFormElementSetValue it shows this example: ; ******************************************************* ; 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") Edited March 19, 2009 by Manadar github.com/jvanegmond
Stilgar Posted March 19, 2009 Posted March 19, 2009 I see. That is important for Javascript, but not for IE COM in my opinion since a process is already running that has access to your hard drive.If you look in the IE.au3 every "function" on the com-objects are Javascript-functions, so I think this is blocked by the IE. jEdit4AutoIt PlanMaker_UDF
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