Prev: VbScript and Windows 7 x64 - in IEx64 vbscript works, but notin I
Next: VbScript and Windows 7 x64 - in IEx64 vbscript works, but not
From: Tom Lavedas on 24 May 2010 13:27 On May 24, 11:19 am, mrk <no.ente...(a)hot.com> wrote: > Hi > > I'm new in VBScript. I mean almost because at this time I've written > scripts which operates on text files only. > Now I would like to try automate Internet explorer. > > I wrote simple script opening page > >----------------------------< > set oie=createobject("internetexplorer.application") > oie.visible=true > oie.navigate("www.google.com") > >--------------------------< > > In next step I met problems with forms. > How to retrieve or how to fill forms? > > For example how to login automaticly on mail.google.com using VBScript? Figure out what the controls are called and then use the document.all collection to address them, something like this ... set oie=createobject("internetexplorer.application") with oie .visible=true .navigate "https://mail.google.com/" ' go straight to mail login 'wait for it to finish loading do until .readystate = 4 : wsh.sleep 100 : loop 'fill in the values and submit with .document.all .Email.value = "userID" .Passwd.value = "P(a)ssw0rd" .signIn.click end with end with ' oIE BTW, this leaves your ID and password exposed to anyone who has access to read the login script. _____________________ Tom Lavedas
From: mrk on 24 May 2010 13:47 Tom Lavedas napisal w dniu 2010-05-24 19:27: > On May 24, 11:19 am, mrk<no.ente...(a)hot.com> wrote: >> Hi >> >> I'm new in VBScript. I mean almost because at this time I've written >> scripts which operates on text files only. >> Now I would like to try automate Internet explorer. >> >> I wrote simple script opening page >> >----------------------------< >> set oie=createobject("internetexplorer.application") >> oie.visible=true >> oie.navigate("www.google.com") >> >--------------------------< >> >> In next step I met problems with forms. >> How to retrieve or how to fill forms? >> >> For example how to login automaticly on mail.google.com using VBScript? > > > Figure out what the controls are called and then use the document.all > collection to address them, something like this ... > > set oie=createobject("internetexplorer.application") > with oie > .visible=true > .navigate "https://mail.google.com/" ' go straight to mail login > 'wait for it to finish loading > do until .readystate = 4 : wsh.sleep 100 : loop > 'fill in the values and submit > with .document.all > .Email.value = "userID" > .Passwd.value = "P(a)ssw0rd" > .signIn.click > end with > end with ' oIE > > BTW, this leaves your ID and password exposed to anyone who has access > to read the login script. > _____________________ > Tom Lavedas I thought that best for it should be: http://msdn.microsoft.com/en-us/library/ms537457%28VS.85%29.aspx Previously I tried above collection but I don't know how to use it.
From: Tom Lavedas on 24 May 2010 14:01
On May 24, 1:47 pm, mrk <no.ente...(a)hot.com> wrote: > Tom Lavedas napisal w dniu 2010-05-24 19:27: > > > > > On May 24, 11:19 am, mrk<no.ente...(a)hot.com> wrote: > >> Hi > > >> I'm new in VBScript. I mean almost because at this time I've written > >> scripts which operates on text files only. > >> Now I would like to try automate Internet explorer. > > >> I wrote simple script opening page > >> >----------------------------< > >> set oie=createobject("internetexplorer.application") > >> oie.visible=true > >> oie.navigate("www.google.com") > >> >--------------------------< > > >> In next step I met problems with forms. > >> How to retrieve or how to fill forms? > > >> For example how to login automaticly on mail.google.com using VBScript? > > > Figure out what the controls are called and then use the document.all > > collection to address them, something like this ... > > > set oie=createobject("internetexplorer.application") > > with oie > > .visible=true > > .navigate "https://mail.google.com/" ' go straight to mail login > > 'wait for it to finish loading > > do until .readystate = 4 : wsh.sleep 100 : loop > > 'fill in the values and submit > > with .document.all > > .Email.value = "userID" > > .Passwd.value = "P(a)ssw0rd" > > .signIn.click > > end with > > end with ' oIE > > > BTW, this leaves your ID and password exposed to anyone who has access > > to read the login script. > > _____________________ > > Tom Lavedas > > I thought that best for it should be:http://msdn.microsoft.com/en-us/library/ms537457%28VS.85%29.aspx > > Previously I tried above collection but I don't know how to use it. The all collection just sidesteps the forms. In either case, the individual controls need to be addressed. To do it with forms requires identifying which form to access and then address the control inside that form. It would appear to me that a developer might find a form useful to collect all of the data from overt and hidden controls, etc. into a single submission string, but beyond that, I don't see its value. _____________________ Tom Lavedas |