![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | write into an <input type=file> field Hello, There is a page on the web with an input type=file field named "sourcefile". While I can fill in the other fields in the form, nothing is written using ..document.forms(0).Item("sourcefile").value = "C:\Users\standard\Desktop\fax.doc" The only way is to use sendkeys. The fact is that if I manually select a file and then READ the value, it is correctly retrieved. msgbox .document.forms(0).item("sourcefile").value returns the name of the file selected. I can set the content of the field with a script in a local html file, but it seems not to work (nothing is written to the field) in a vbs which loads the page and fills the form. Being able to read the content, I am sure the path to the field is correct. Thank you for your help. Giovanni. -- Giovanni Cenati (Bergamo, Italy) Write to "Reventlov" at katamail com http://digilander.libero.it/Cenati (Esempi e programmi in VbScript) -- |
My System Specs![]() |
| | #2 (permalink) |
| | Re: write into an <input type=file> field "Reventlov" <noone@xxxxxx> wrote in message news:49acec72.56705734@xxxxxx Quote: > Hello, > There is a page on the web with an input type=file field named > "sourcefile". > While I can fill in the other fields in the form, nothing is written using > .document.forms(0).Item("sourcefile").value = > "C:\Users\standard\Desktop\fax.doc" > The only way is to use sendkeys. > > The fact is that if I manually select a file and then READ the value, it > is correctly > retrieved. > msgbox .document.forms(0).item("sourcefile").value > returns the name of the file selected. > > I can set the content of the field with a script in a local html file, but > it seems not to > work (nothing is written to the field) in a vbs which loads the page and > fills the form. > > Being able to read the content, I am sure the path to the field is > correct. > > Thank you for your help. > Giovanni. how it does or doesn't work, and post it here? -Paul Randall |
My System Specs![]() |
| | #3 (permalink) |
| | Re: write into an <input type=file> field On Mar 4, 3:38*pm, no...@xxxxxx (Reventlov) wrote: Quote: > Hello, > There is a page on the web with an input type=file field named "sourcefile". > While I can fill in the other fields in the form, nothing is written using > .document.forms(0).Item("sourcefile").value = *"C:\Users\standard\Desktop\fax.doc" > The only way is to use sendkeys. > > The fact is that if I manually select a file and then READ the value, it is correctly > retrieved. > msgbox .document.forms(0).item("sourcefile").value > returns the name of the file selected. > > I can set the content of the field with a script in a local html file, but it seems not to > work (nothing is written to the field) in a vbs which loads the page and fills the form. > > Being able to read the content, I am sure the path to the field is correct. > > Thank you for your help. > Giovanni. > > -- > Giovanni Cenati (Bergamo, Italy) > Write to "Reventlov" at katamail comhttp://digilander.libero.it/Cenati(Esempi e programmi in VbScript) > -- Otherwise, permitting a default value to be defined would open a security hole. That is, a web page author could preload the INPUT element value with file names and upload them to his/her server without requiring the client's interaction. Not a good thing. The use of Sendkeys is the only known way to populate a file type input box (in a client initiated script application). That's why I worked to find a way to use drag-and-drop onto IFRAMEs in HTAs. It greatly simplifies the loading of files. Tom Lavedas *********** http://there.is.no.more/tglbatch/ |
My System Specs![]() |
| | #4 (permalink) |
| | Re: write into an <input type=file> field Il giorno Wed, 4 Mar 2009 13:40:39 -0800 (PST), T Lavedas <tglbatch@xxxxxx> ha scritto: Quote: Quote: >> There is a page on the web with an input type=3Dfile field named "sourcef= Quote: >> While I can fill in the other fields in the form, nothing is written usin= Quote: >> .document.forms(0).Item("sourcefile").value =3D =A0"C:\Users\standard\Des= Quote: >> The only way is to use sendkeys. Quote: >This is the intended behavior of the FILE type of the INPUT element. >Otherwise, permitting a default value to be defined would open a >security hole. That is, a web page author could preload the INPUT >element value with file names and upload them to his/her server >without requiring the client's interaction. Not a good thing. > >The use of Sendkeys is the only known way to populate a file type >input box (in a client initiated script application). That's why I >worked to find a way to use drag-and-drop onto IFRAMEs in HTAs. It >greatly simplifies the loading of files. It is important to know there is a reason for this behaviour. -- Giovanni Cenati (Bergamo, Italy) Write to "Reventlov" at katamail com http://digilander.libero.it/Cenati (Esempi e programmi in VbScript) -- |
My System Specs![]() |
| | #5 (permalink) |
| | Re: write into an <input type=file> field Il giorno Wed, 4 Mar 2009 14:20:57 -0700, "Paul Randall" <paulr90@xxxxxx> ha scritto: Quote: >Can you build a little HTA that contains the relevant code and demonstrates >how it does or doesn't work, and post it here? it might be of help for those who want to automate interaction with a web site. WScript.CreateObject("InternetExplorer.Application", "oIE_") ' Setta le proprietà della finestra del browser oIE.left = 20 ' La finestra oIE.top = 50 ' in alto a sinistra, oIE.height = 380 ' piccola... oIE.width = 580 oIE.menubar = 0 ' Senza menu oIE.toolbar = 0 ' né barra degli strumenti oIE.statusbar = 0 ' né barra di stato per essere più riconoscibile. oIE.navigate("about:blank") ' Crea un documento HTML vuoto. oIE.visible = 1 homepage="http://corrisp/dsp.asp?pagenumber=1" oIE.navigate(homepage) 'Richiede la pagina Do until oIE.readystate = 4 : wscript.sleep 10: Loop oie.Document.Forms(0).item("nr").Value = "1368223" oie.Document.Forms(0).item("dt").Value = "2008" oIE.Document.forms(0).submit but oie.document.forms(0).item("file").value ="c:\data.txt" doesn't fill the field. -- Giovanni Cenati (Bergamo, Italy) Write to "Reventlov" at katamail com http://digilander.libero.it/Cenati (Esempi e programmi in VbScript) -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| how to get powershell to write to event log or write a log file? | PowerShell | |||
| doesn't display me to write Filename and file type | General Discussion | |||
| VbSystemModal type functionality for Read-Host input | PowerShell | |||
| Input Type Hidden and Checkbox? | VB Script | |||
| Don't write your Password in the User field on a fresh Vista insta | Vista account administration | |||