home *** CD-ROM | disk | FTP | other *** search
-
- Option Explicit
-
- Dim listArgs
-
- Dim objWSHShell
- Dim objShortcut
-
- Dim zProgram
- Dim zName
- Dim zSpecialFolder
-
- ' Klucz w Rejestrze integruj╣cy skrypt w menu kontekstowym
- Const constRegKey = "HKEY_CLASSES_ROOT\exefile\shell\Zintegruj w menu Wy£lij do\"
- Const constRegKeyFolder = "HKEY_CLASSES_ROOT\Folder\shell\Zintegruj w menu Wy£lij do\"
-
- Const constRegKeyUninstall = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\createSendTo\"
-
- ' Tworzymy obiekty
- Set objWSHShell = WScript.CreateObject("WScript.Shell")
-
- ' Je┐eli brak argumentu (=integruj z menu)
- ' W innym wypadku zako±cz instalacjΩ
- Set listArgs = WScript.Arguments
-
- If listArgs.Count = 0 Then
-
- ' Je┐eli nie ma ┐adnego parametru: Instaluj
- installSkript
-
- Else
-
- zProgram = listArgs(0)
-
- If zProgram = "-deinstall" Then
-
- ' Deinstalacja skryptu
- deinstallSkript
-
- Else
-
- ' Podaj folder Wy£lij do
- zSpecialFolder = objWSHShell.SpecialFolders("SendTo")
-
- ' Pytanie o nazwe
- zName = InputBox("Podaj nazwe elementu, kt≤ry ma siΩ znaleƒµ w menu ""Wy£lij do"" ")
-
- If (MsgBox("Dodaj " & zName & " do ""Wy£lij do""?", vbYesNo + vbQuestion, "Czy tak?")=vbYes) Then
-
- Set objShortcut = objWSHShell.CreateShortcut (zSpecialFolder & "\" & zName & ".lnk")
- objShortcut.TargetPath = zProgram
- objShortcut.Save
- Set objShortcut = nothing
-
- End If
-
- End If
-
- End If
-
- Set listArgs = nothing
- Set objWSHShell = nothing
-
- ' Koniec skryptu
- Wscript.Quit
-
-
-
-
- '
- ' Funkcjaon: installSkript()
- ' ---------------------------
-
- Function installSkript ()
-
- If (MsgBox("Czy zintegrowaµ skrypt z menu kontekstowym?", vbYesNo + vbQuestion, "Instalowaµ?")=vbYes) Then
-
- ' Dodanie do menu pliku EXE, katalogu lub napΩdu
- objWshShell.RegWrite constRegKey & "command\", """" & WScript.Fullname & """ """ & WScript.ScriptFullName & """ ""%1"""
- objWshShell.RegWrite constRegKeyFolder & "command\", """" & WScript.Fullname & """ """ & WScript.ScriptFullName & """ ""%1"""
-
- ' Informacje o instalcji
- objWshShell.RegWrite constRegKeyUninstall & "DisplayName", "VBSkrypt CreateSendTo"
- objWshShell.RegWrite constRegKeyUninstall & "DisplayVersion", "2.0"
- objWshShell.RegWrite constRegKeyUninstall & "HelpLink", "http://www.chip.pl"
- objWshShell.RegWrite constRegKeyUninstall & "Publisher", "CHIP"
- objWshShell.RegWrite constRegKeyUninstall & "UninstallString", """" & WScript.Fullname & """ """ & WScript.ScriptFullName & """ ""-deinstall"""
-
- ' Gotowe!
- MsgBox "Skrypt """ & WScript.ScriptName & """ zosta│ dodany!"
-
- End If
-
- End Function
-
- '
- ' Funkcja: deinstallSkript()
- ' ---------------------------
-
- Function deinstallSkript ()
-
- If (MsgBox("Czy usun╣µ skrypt?", vbYesNo + vbQuestion, "Usun╣µ?")=vbYes) Then
-
- ' Usuwanie z menu kontekstowego
- objWshShell.RegDelete constRegKey & "command\"
- objWshShell.RegDelete constRegKey
-
- objWshShell.RegDelete constRegKeyFolder & "command\"
- objWshShell.RegDelete constRegKeyFolder
-
- ' Kasowanie informacji o instalacji
- objWshShell.RegDelete constRegKeyUninstall
-
- End If
-
- End Function
-
-
- '
- ' Funkcja: RegKeyExists()
- ' -----------------------
-
- Function RegKeyExists (zRegKey)
-
- Dim zValue
-
- On Error Resume Next
-
- zValue = objWshShell.RegRead(zRegKey)
- If err.number <> 0 Then
- RegKeyExists = False
- Else
- RegKeyExists = True
- End If
-
- End Function
-