2008-11-03

Chrome_Incgonito(2).js

If you haven't updated to 0.3.154.9 this script may still be of use. But, with that version you can now append: ...chrome.exe" --incognito to your Google Chrome shortcut and it will start in Incognito mode by default.

The original script is much "thinner". The differences between them:

-checks to see if chrome is already started - if it has script simply quits.
-sets first URL to use google as a proxy

If you have trouble saving code snippits see notes here.
//Chrome_Incognito(2).js - start chrome incognito
var SN=WScript.ScriptName;
var oSh=new ActiveXObject('WScript.Shell');
var liWait=1500;//wait ms (double on older pc)
var sURL='http://translate.google.com/'+
  'translate'+'?ie=UTF-8'+
  '&sl=es'+'&tl=en'+'&hl=en'+'&u='+
  'http://www.anonymouse.org'
//-
//The above is a "google proxy" - translates a page from spanish to english
//this by default re-renders the same english trans - but allows you to
//escape beyond a firewall via google servers(if you need to) --
//anonymouse.org then hides your ip...
//-
var Chrome_HKLM='HKLM\\'+'SOFTWARE\\' + 
  'Classes\\'+'ChromeHTML\\' + 
  'shell\\'+'open\\'+ 'command\\';
Chrome=oSh.RegRead(Chrome_HKLM);
Chrome=Chrome.replace(' "%1"','');
//-
//Check to see if Chrome is already running...
//-
var oFS=new ActiveXObject('Scripting.FileSystemObject');
var sComspec=oSh.ExpandEnvironmentStrings('%COMSPEC%') 
var sSystemRoot=oSh.ExpandEnvironmentStrings('%SYSTEMROOT%') 
var sUserprofile=oSh.ExpandEnvironmentStrings('%USERPROFILE%');
sComspec=sComspec.replace(/%SystemRoot%/g,sSystemRoot);
sUserprofile=sUserprofile.replace(/\\/g,'\\');
var sRun='"'+
  sComspec+
  '" /c TaskList/v>"'+
sUserprofile+
  '\\My Documents\\TaskList.txt"';
oSh.Run(sRun,0,true);
var oTaskList;
var oTaskList_FN=sUserprofile+
  '\\My Documents\\TaskList.txt';
var oTaskList=oFS.OpenTextFile(oTaskList_FN,1);
var sTaskList_text=oTaskList.ReadAll();
oTaskList.Close();
var nFound=sTaskList_text.indexOf("chrome.exe");
  sRun='"'+
  sComspec+
  '" /c '+
  'if exist "'+sUserprofile+'\\My Documents\\TaskList.txt" '+
  'del "'+sUserprofile+'\\My Documents\\TaskList.txt"';
if (nFound!='-1')
 { oSh.popup('Google Chrome already appears to have been started...',3,SN);
  WScript.Quit();
 };
//-
//Run Chrome
//-
oSh.Run(Chrome,1,false);
var pid=false;
var sWTitle='New Tab - Google Chrome';
while (pid==false)
{ WScript.Sleep(250); 
 pid=oSh.AppActivate(sWTitle);
};
WScript.Sleep(liWait); 
oSh.Sendkeys('^+N');   //start new incognito window
WScript.Sleep(liWait); 
oSh.Sendkeys('%{Tab}');   //go previous(first) browser window
WScript.Sleep(liWait); 
oSh.Sendkeys('%{F4}');   //close first browser window
WScript.Sleep(liWait); 
oSh.Sendkeys('{F6}');   //go addressbar
WScript.Sleep(liWait); 
oSh.SendKeys(sURL+'{Enter}'); //supply 'google proxy'
WScript.Sleep(liWait); 

No comments:

LibriVox's New Releases

Blog Archive

Powered By Blogger