User script: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Test
m Arantius moved page Category:User script to User script over a redirect without leaving a redirect: vandalism
 
(31 intermediate revisions by 15 users not shown)
Line 1: Line 1:
var Web          = "HEATsnipers";         
User scripts are programs which make on-the-fly changes to specific web pages, typically to change their appearance or to add or modify functionality.
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 for [[Greasemonkey]] and Greasemonkey-compatible alternatives are written in [http://developer.mozilla.org/en/docs/JavaScript JavaScript].
If you would like to write user scripts yourself, see [[Greasemonkey Manual:Editing]].


CreateWeb(Web + DNSroot,sRootDir,Web);
== See Also ==
 
* [[wikipedia:Augmented browsing|Augmented browsing at 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);
 
 
}

Latest revision as of 23:58, 17 April 2024

User scripts are programs which make on-the-fly changes to specific web pages, typically to change their appearance or to add or modify functionality.

User scripts for Greasemonkey and Greasemonkey-compatible alternatives are written in JavaScript. If you would like to write user scripts yourself, see Greasemonkey Manual:Editing.

See Also