Showing posts with label WScript. Show all posts
Showing posts with label WScript. Show all posts

2007-08-28

Automatic Login to google with WScript.

WScript is the short name for Windows Script. It can be a VBScript or JScript(not Javascript but a Microsoft standard!) If we use it properly, it can save us a lot of work. Here is an example for a script which can be used to login in google account automaticly.

var ie=WScript.createobject("InternetExplorer.Application");
var args = WScript.arguments;
var followme="http://www.google.com/";
if(args.length>0)
{
followme
+=args(0);
}
ie.Navigate(
"https://www.google.com/accounts/Login?continue="+followme);
SynchronizeIE();
var doc=ie.document;
doc.forms[
0].Email.value="yourName@gmail.com";
doc.forms[
0].Passwd.value="^your password";

//because the checkbox "PersistentCookie" appears randomly
if(doc.forms[0].PersistentCookie!=null)
{
doc.forms[
0].PersistentCookie.checked=false;
}
doc.forms[
0].submit();
SynchronizeIE();
ie.Visible
=true;

//wait for IE finishs its job
function SynchronizeIE()
{
while(ie.Busy)
{
WScript.Sleep(
100);
}
}

Save the code as googleSpecific.js and make it under the %windir%\system32, then create a file called google.bat under the same path with the content:

@cls

@wscript %windir%\system32\googleSpecific.js %1 %2 %3 %4 %5 %6 %7 %8 %9

After that, execute "google mail" in command promp, you can log in your gmail directly now.

Other commands are:
google notebook
google bookmarks
If you type "google" without any parameters, you will sign in with the google.com.