Google Script

last modified: April 6, 2005

A javascript that interacts with google to generate its results.

' gmail.vb - gets unread gmail as an atom feed
' for Alintex Script - www.alintex.com
' usage: ax(w)script [username] [password] gmail.vb

imports System
imports System.Net
imports System.IO
imports System.Text

#region "Script"

' check commandline arguments
if (args.Length < 2)
   print("gmail.vb - gets unread gmail as an atom feed")
   print("Usage: ax(w)script [username] [password] gmail.vb")
   return
end if

' connect to gmail and retrieve the atom xml feed
client = new WebClient
bytes = Encoding.ASCII.GetBytes(args(0) & ":" & args(1))
client.Headers.Add("Authorization", "Basic " & _
   Convert.ToBase64String(bytes))

gmailUri = "https://gmail.google.com/gmail/feed/atom"
dim feedStream as Stream = client.OpenRead(gmailUri)
reader = new StreamReader(feedStream)
feedAsXml = reader.ReadToEnd()
feedStream.Close()

print(feedAsXml)

#end region

Loading...