1、 13-1.VBS2 13-2.VBS4 13-3.VBS6 13-4.VBS8 13-5.VBS10 13-6.VBS12 13-7.VBS15 13-1.VBS-the following lines have been added to ensure all required COM objects are available on your system. script uses the following components: scripting.filesystemobject wscript.shellCheckCOM-end of COM-object checking co
2、de-set args = WScript.Argumentsif args.Count=0 thenMsgBox “Please drag a vbs script file on my icon.“ _& “ Ill place it into the Startup group!“WScript.Quitend ifset fs = CreateObject(“Scripting.FileSystemObject“)set wshshell = CreateObject(“WScript.Shell“)scriptfile = args(0)if not lcase(fs.GetExte
3、nsionName(scriptfile)=“vbs“ thenMsgBox “I only accept vbs script files!“WScript.Quitend ifstartup = wshshell.SpecialFolders(“Startup“)name = InputBox(“Under which name should I place the script “ _& “ & fs.GetBaseName(scriptfile) & “ into the StartUp-“ _& “Group?“, “autostart script“)set scut = wshs
4、hell.CreateShortcut(startup & “ & name & “.lnk“)scut.TargetPath = scriptfilescut.SaveMsgBox “Script has been successfully linked to your StartUp group!“ - the following code had been automatically added to ensure all required COM objects are installed.function COMExists(name) checks whether a specif
5、ic COM object is installed on your local machineset cwsh = CreateObject(“WScript.Shell“)on error resume nextdummy = cwsh.RegRead(“HKCR“ & name & “)if err.number0 thenCOMExists = falseelseCOMExists = trueend ifend functionsub CheckCOMif not COMExists(“scripting.filesystemobject“) thenmsg=“COM-Object
6、“scripting.filesystemobject“ is required. This object is currently not installed on your system.“ & vbCrmsg = msg & “Reinstall the Windows Scripting Host!“ & vbCrMsgBox msg, vbExclamationend ifif not COMExists(“wscript.shell“) thenmsg=“COM-Object “wscript.shell“ is required. This object is currently
7、 not installed on your system.“ & vbCrmsg = msg & “Reinstall the Windows Scripting Host!“ & vbCrMsgBox msg, vbExclamationend ifend sub- end of COM object checking code (C) 2000 by Dr. T. Weltner - all rights reserved. 13-3.VBS-the following lines have been added to ensure all required COM objects ar
8、e available on your system. script uses the following components: wscript.shellCheckCOM-end of COM-object checking code-set wshshell = CreateObject(“WScript.Shell“)key = “HKLMSoftwareMicrosoftWindowsCurrentVersionRun“ use this key on Windows NT/2000:key = “HKLMSoftwareMicrosoftWindows NTCurrentVersi
9、onRun“wshshell.RegDelete key & “myscript“MsgBox “Deleted script entry from Registry.“ - the following code had been automatically added to ensure all required COM objects are installed.function COMExists(name) checks whether a specific COM object is installed on your local machineset cwsh = CreateOb
10、ject(“WScript.Shell“)on error resume nextdummy = cwsh.RegRead(“HKCR“ & name & “)if err.number0 thenCOMExists = falseelseCOMExists = trueend ifend functionsub CheckCOMif not COMExists(“wscript.shell“) thenmsg=“COM-Object “wscript.shell“ is required. This object is currently not installed on your syst
11、em.“ & vbCrmsg = msg & “Reinstall the Windows Scripting Host!“ & vbCrMsgBox msg, vbExclamationend ifend sub- end of COM object checking code (C) 2000 by Dr. T. Weltner - all rights reserved. 13-6.VBS-the following lines have been added to ensure all required COM objects are available on your system.
12、 script uses the following components: wscript.shellCheckCOM-end of COM-object checking code-set wshshell = CreateObject(“WScript.Shell“) find out the script file you want to use as command extensionset args = WScript.Argumentsif args.Count=0 thenMsgBox “Please drag a vbs script file onto my script
13、icon!“WScript.Quitend if did I receive a vbs file?if not lcase(Mid(args(0), InstrRev(args(0), “.“)=“.vbs“ thenMsgBox “I only accept vbs script files!“WScript.Quitend if which file type do you want to append?filetype = InputBox(“Please enter the file extension for the “ _& “file type you want to add
14、a context menu command to!“, _, “.vbs“)if not left(filetype,1)=“.“ then filetype = “.“ & filetype find out whether this key existson error resume nextprgkey = wshshell.RegRead(“HKCR“ & filetype & “) file type unknown!if not err.number=0 thenMsgBox “File Type “ & filetype & “ is unknown!“WScript.Quit
15、end ifon error goto 0 insert this key as new context menu command:name = InputBox(“How do you want to call your new command?“, _,“Show size“) start with this keykey1 = “HKCR“ & prgkey & “shell“ insert command namewshshell.RegWrite key1 & name & “, name insert commandwshshell.RegWrite key1 & name & “
16、command“, _“wscript.exe “ & “ & args(0) & “ & “ “%L“MsgBox “New command installed successfully!“ - the following code had been automatically added to ensure all required COM objects are installed.function COMExists(name) checks whether a specific COM object is installed on your local machineset cwsh
17、 = CreateObject(“WScript.Shell“)on error resume nextdummy = cwsh.RegRead(“HKCR“ & name & “)if err.number0 thenCOMExists = falseelseCOMExists = trueend ifend functionsub CheckCOMif not COMExists(“wscript.shell“) thenmsg=“COM-Object “wscript.shell“ is required. This object is currently not installed o
18、n your system.“ & vbCrmsg = msg & “Reinstall the Windows Scripting Host!“ & vbCrMsgBox msg, vbExclamationend ifif not COMExists(“clip.board“) thenmsg=“COM-Object “clip.board“ is required. This object is currently not installed on your system.“ & vbCrmsg = msg & “Install the CLIPBOARD component from CD“ & vbCrMsgBox msg, vbExclamationend ifend sub- end of COM object checking code (C) 2000 by Dr. T. Weltner - all rights reserved.