JavaScript Classic Custom Function [Repost]

xiaoxiao2021-03-06  42

Some errors, find them, exercise one :)

// Get the printer on the network Function getNetprinter () {var obj = new activXObject ("wscript.network"); var netprinter = obj.enumprinterConnections (); for (i = 0; i {document.writeln (Netprinter.Item) I) "=" NetPrinter.item (i 1));}} // acquired Disk information Incoming parameters such as: getDiskinfo ('c') function getDiskinfo (para) {var fs = new activXObject ("scripting. FileSystemObject "); d = fs.getdrive (para); s =" volume: " D.VolumnName; s =" ------ " " remaining space: " D.Freespace / 1024/1024 D.FREESPACE / 1024/1024 "M"; s = "------" "disk serial number:" D.SerialNumber; Alert (s)} // acquisition system directory Function getProcessNum () {var pnsys = new ActiveXObject ("WScript. "); pn = pnsys.environment (" process "); Alert (" windir "));} // Start calculator Function Runcalc () {var Calc = New ActiveXObject (" wscript.shell "); CALC .Run ("CALC");} // Read the value in the registry Function ReadReg () {var myreadreg = New ActiveXObject ("wscript.shell"); try {alert (MyReadreg.regread ("HKEY_LOCAL_MACHINE // Software / / Microsoft // Windows // CurrentVersion // Run // Nerocheck "));} Catch (e) {Alert (" Read the value does not exist! ");}} // write registry Function WriteReg () {var MyWriteReg = New ActiveXObject ("wscript.shell"); try {mywritereg.regwrite ("h Key_Local_Machine // Software // Microsoft // Windows // CurrentVersion // Run // MyTest "," C: //Mytest.exe "); Alert (" written successfully! ");} Catch (e) {Alert (" Write path is incorrect! ");}} // Delete Registry Function delReg () {var mydelreg = New ActiveXObject (" wscript.shell "); if (Confirm); "Do you really delete?")) {Try {myDelreg.regdelete ("HKEY_LOCAL_MACHIN / / SOFTWARE // Microsoft // Run //rtest"); Alert ("Delete Success!");} Catch (e) {alert ("Delete path is incorrect"

);}}} // acquired computer name domain name username Function NetInfo () {var mynetinfo = new ActiveXObject ("wscript.network"); Alert ("Computer Name:" MyNetInfo.computername "domain name:" mynetinfo.urserdomain "User Name:" MYNETINFO.USERNAME);} // Return to the path to the special directory in the system (Fonts, ALLUSDESKTOP, Desktop, MyDocuments, Recent .....) Function GetSpecialFolder () {var mygetfolder = new ActiveXObject ("WScript . SHELL "); IF (MygetFolder.SpecialFolders (" fonts ")! = null) {Alert (MygetFolder.SpecialFolders (" fonts "));}} // Get file information calling method such as: getFileInfo ('E: // Myper // test // myjs.htm ') Function getFileinfo (Para) {var myfile = new activXObject ("scripting.FilesystemObject"); var fi = myfile.getfile (para); Alert ("File Type:" Fi. TYPE "file size:" fi.size / 1024/1024 " " last access time: " fi.dateLastAccessed);} // Get the client's information Function ClientInfo () {STRCLIENTINFO =" availheight = " window.screen.availHeight "/ n" "availWidth =" window.screen.availWidth "/ n" "bufferDepth =" window.screen.bufferDepth "/ n" "colorDepth =" window.screen. ColorDepth "/ N" "Colorenable =" WINDOW.NAVIGATOR.COOKIEENABLED "/ N" "cpuclass =" window.navigator.cpuclass "/ N " " height = " window.screen.height " / n " " javaenable = " window.navigator.javaenabled () " / n " " platform = " window.navigator.Platform " / n " "SystemLanguage =" WINDOW.NAVIGATOR.SYSTEMLANGUAGUE "/ N" "Userlanguage ="

WINDOW.NAVIGATOR.USERLANGUAGUE "/ n" "width =" window.screen.width; Alert (strclientInfo);} // Dilog Helper object Using Function ChangeColor () // DILOG HELPER object Used call system color Board {var scolor = dlghelper.choosecolordlg (); scolor = scolor.tostring (16); if (Scolor.Length <6) {var stempstring = "000000" .substring (0,6-scolor.length); scolor = STEMPSTRING .concat (scolor);} alert (scolor); mybody.style.backgroundColor = scolor;} Function getFonts () // DILOG HELPER object's use of system support font {var strfonts = ""; for (var i = 1; i {strfonts = strfonts DLGHELPER.FONTS (i) "|";} Alert (strfonts);} Function getBlockFormat () // DILOG HELPER object's use acquisition system block format information (such as: Title 1 , Title 2 ....) {var strblockformat = ""; for (var i = 1; i {strblockformat = strblockformat dlghelper.blockformats (i) "|";} alert (strblockformat);

转载请注明原文地址:https://www.9cbs.com/read-53222.html

New Post(0)