Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VBS login Google Finance webpage

14 views
Skip to first unread message

moonhk

unread,
Nov 4, 2009, 10:06:31 AM11/4/09
to
Hi

I want download my portfolio.
First login Google finance
https://www.google.com/accounts/ServiceLoginAuth?service=finance
Second, Change to below url
http://www.google.com/finance/portfolio?action=view&pid=4
Then Download this url

Do you know how to do step 1 and Step 2 ?

moonhkt

Tom Lavedas

unread,
Nov 4, 2009, 1:54:42 PM11/4/09
to
On Nov 4, 10:06 am, moonhk <moon...@gmail.com> wrote:
> Hi
>
> I want download my portfolio.
> First login Google financehttps://www.google.com/accounts/ServiceLoginAuth?service=finance
> Second, Change to below urlhttp://www.google.com/finance/portfolio?action=view&pid=4

> Then Download this url
>
> Do you know how to do step 1 and Step 2 ?
>
> moonhkt

I believe this will do what you want, though I suspect there is a more
direct way that does not require opening the page ...

sURL1 = "https://www.google.com/accounts/ServiceLogin?service=finance"
sURL2 = "http://www.google.com/finance/portfolio?action=view&pid=4"
sFilename = "D:\Someplace\somename.html"
with CreateObject("InternetExplorer.Application")
.Navigate sURL1
Do until .ReadyState = 4 : WScript.Sleep 100 : Loop
.visible = true
With .document.all
.email.value = "you...@yourdomain.com"
.passwd.value= "yourpassword" ' or Inputbox to ask the password
.signin.click
End With ' document
.Navigate sURL2
Do until .ReadyState = 4 : WScript.Sleep 100 : Loop
sText = .document.body.outerHTML
with createobject("scripting.filesystemobject")
.OpenTextFile(sFilename, 2, true, true).write sText
end with ' FSO
.quit ' optional
End With ' IE
_____________________
Tom Lavedas

Tom Lavedas

unread,
Nov 4, 2009, 3:28:29 PM11/4/09
to
On Nov 4, 1:54 pm, Tom Lavedas <tglba...@cox.net> wrote:
> On Nov 4, 10:06 am, moonhk <moon...@gmail.com> wrote:
>
> > Hi
>
> > I want download my portfolio.
> > First login Google financehttps://www.google.com/accounts/ServiceLoginAuth?service=finance
> > Second, Change to below urlhttp://www.google.com/finance/portfolio?action=view&pid=4
> > Then Download this url
>
> > Do you know how to do step 1 and Step 2 ?
>
> > moonhkt
>
> I believe this will do what you want, though I suspect there is a more
> direct way that does not require opening the page ...
{code snipped}

I knew there was a more direct method ...

sURL2 = "http://www.google.com/finance/portfolio?action=view&pid=4"
sFilename = "D:\Someplace\somename.html"

' Get page
sUID = "you...@yourdomain.com"
sPW = "password"
sData = GetXml(sPage, sUID, sPW)
'now save the page to a file.
CreateObject("Scripting.FileSystemObject")._
OpenTextFile(FilePath, 2, True, true).Write sData

Wscript.Echo "Done"

Function GetXml(sURL, userID, Password)
' Create an xmlhttp object:
With CreateObject("Microsoft.XMLHTTP")
.open "GET", sURL, false, userID, password
.send
GetXml = .responseText
End With
End Function

With later versions of IE (7+) loaded, I believe the
"Microsoft.XMLHTTP" is replaced with the "XMLHttpRequest" object
instead.
_____________________
Tom Lavedas

moonhk

unread,
Nov 4, 2009, 7:54:44 PM11/4/09
to

Hi Tom
Thank. it works on First VBS. Due to I does not have IE(7+). I can not
test on second vbs.

moonhkt

Joe Fawcett

unread,
Nov 14, 2009, 4:35:04 AM11/14/09
to

"Tom Lavedas" <tglb...@cox.net> wrote in message
news:80c6cb8a-6a1c-48e8...@a32g2000yqm.googlegroups.com...

IE7+ have both versions so you can use either. Personally I would use
msxml2.Xml.3.0 which is "all" machines and is usually better than the
original microsoft.xmlhttp. If you're running on a specific machine that you
know has the latest update then use msxml2.XmlHttp.6.0.


--

Joe Fawcett
http://joe.fawcett.name

0 new messages