User script: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Test
m Reverted edits by 69.66.93.37 (Talk) to last revision by Arantius
Line 1: Line 1:
var Web          = "HEATsnipers";         
{{stub}}
var strRRsufix    = ". IN A 192.168.51.200";
var ServerBinding = "192.168.001.051:80:"; 
var DNSroot      = "..com";
var strDomain    = ".com";
var sRootDir      = "c:\\Site Stuff";     


'''User scripts''', or '''userscripts''', are scripts that make on-the-fly changes to specific web pages on the client side (in the browser or a proxy server), typically to change their appearance or to add or modify functionality.


CreateWeb(Web + DNSroot,sRootDir,Web);
User scripts for [[Greasemonkey]] and Greasemonkey-compatible alternatives are written in [http://developer.mozilla.org/en/docs/JavaScript JavaScript], but there is at least one example of using another scripting language, namely Ruby in [http://github.com/why/mousehole/tree/master/ MouseHole].


 
For tools other than Greasemonkey that apply user scripts to web sites, see [[Cross-browser_userscripting|Cross-browser Userscripting]] and [http://en.wikipedia.org/wiki/Greasemonkey#Compatibility Wikipedia].
function CreateWeb( sHostName, sRootDir, comments )
{
var oWeb = GetObject("IIS://localhost/W3SVC");
oWeb.GetInfo();
 
var Index = 1;
var cont  = 0;
 
while( cont == 0 )
{
  try
  {
var webobj = GetObject("IIS://localhost/w3svc/" + Index);
  }
  catch( e )
  {
  if( ( e.number & 0xFFFF ) > 0 )
    {
    cont= 1;
    }
  }
  Index = Index + 1;
}
Index = Index - 1;
WScript.Echo( "Next Index: " + Index );
 
WScript.Echo("creating web " + sHostName);
oServer = oWeb.Create("IIsWebServer",Index);
 
oServer.DefaultDoc        = "default.htm, index.htm";
oServer.ServerComment    = comments;
oServer.ConnectionTimeout = 600;
oServer.ServerBindings    = ServerBinding + sHostName;
oServer.SetInfo();
var fs    = new ActiveXObject("Scripting.FileSystemObject");
if( !fs.FolderExists( sRootDir ) )
  var foldr = fs.CreateFolder(sRootDir);
 
oServer  = GetObject("IIS://localhost/w3svc/" + Index );
var oVdir = oServer.Create("IIsWebVirtualDir", "ROOT");
 
oVdir.Path        = sRootDir;
oVdir.AccessRead  = "True";
oVdir.AccessWrite  = "True";
oVdir.AccessScript = "True";
oVdir.SetInfo();
 
WScript.Echo("starting web " + sHostName + " " + Index);
oServer.Start();
 
strRR=sHostName + strRRsufix;
var objDNS      = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\MicrosoftDNS");
var objRR        = objDNS.Get("MicrosoftDNS_ResourceRecord");
var objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name=\".\"");
var strNull      = objRR.CreateInstanceFromTextRepresentation(objDNSServer.Name, strDomain, strRR);
 
 
}

Revision as of 01:44, 7 March 2010


User scripts, or userscripts, are scripts that make on-the-fly changes to specific web pages on the client side (in the browser or a proxy server), typically to change their appearance or to add or modify functionality.

User scripts for Greasemonkey and Greasemonkey-compatible alternatives are written in JavaScript, but there is at least one example of using another scripting language, namely Ruby in MouseHole.

For tools other than Greasemonkey that apply user scripts to web sites, see Cross-browser Userscripting and Wikipedia.