Seth27 Posted July 21, 2006 Posted July 21, 2006 (edited) I want to know, what is wrong Autoit-Code: $o_file = _IEFormElementGetObjByName($o_form, "userfile") _IEFormElementSetValue ($o_file, "Hello.txt") the source-code of the website: <td class="inputDescription">Lokale Datei:</td> <td><input type="File" name="userfile"></td> I don't know, why the program doesn't send "Hello.txt" into the field. It is because of "type="file""? How can I solve this problem? Can you help me? Thank you Edited July 21, 2006 by Seth27
nfwu Posted July 21, 2006 Posted July 21, 2006 Try using a complete path, like: C:\File.txt or something similar. #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode()
Seth27 Posted July 21, 2006 Author Posted July 21, 2006 I tried this with a complete path. The original code is: $o_IE = _IECreate () _IENavigate ($o_IE, "website") $o_form = _IEFormGetObjByName($o_IE, "login_form") $o_login = _IEFormElementGetObjByName($o_form, "login") $o_password = _IEFormElementGetObjByName($o_form, "passwd") _IEFormElementSetValue($o_login, "loginname") _IEFormElementSetValue($o_password, "passwd") _IEFormSubmit($o_form) $FileList=_FileListToArray("C:\income", "*.*", 1) For $i = 1 To Ubound($FileList) - 1 $o_form1 = _IEFormGetObjByName($o_IE, "form1") $o_file = _IEFormElementGetObjByName($o_form1, "userfile") $o_name=_IEFormElementGetObjByName($o_form1, "fname") _IEFormElementSetValue ($o_file, "C:\income\" & $FileList[$i]) _IEFormElementSetValue($o_name, $FileList[$i]) _IEFormSubmit($o_form1) Next The type of fname is text and the type of userfile is file. In fname it writes the name but in userfile it write nothing. I don't know if it is because of the type="file" of userfile.
Moderators big_daddy Posted July 21, 2006 Moderators Posted July 21, 2006 For obvious security reasons you are not allowed to script a <input type=file>. However this is a workaround: #include <IE.au3> $sFilePath = "C:\test.txt" $oIE = _IE_Example("form") $oForm = _IEFormGetObjByName($oIE, "ExampleForm") $oFile = _IEFormElementGetObjByName($oForm, "fileExample") $oFile.focus Send($sFilePath)
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