here's some old code from the cellar. it is meant to recurse through a dev
branch, find all the dlls and ocx files, create a dos batch that executes to
un/register them. all you have to do is modify it to your liking. you'll
need to use the file scripting object, open the file and and maybe instr$
for a text match. easy, breezy, beautiful cover girl!
next time, if you're not familiar w/ netiquette (a word overly used in a
very long thread today), please post questions to groups that have some
correlation to the context/language of your quandry.
hth,
steve
' ====== snip =======
Private mfso
Private mfd
Private mRegStream
Private mURegStream
Private mcstrHeader
Private mcstrErrText
Private mcstrFooter
Private mlngPtr
mcstrHeader = "@echo off" & vbCrLf & "cls" & vbCrLf & "echo [REG]..." &
vbCrLf & vbCrLf & "set has_err=0" & vbCrLf & "set errors=0" & vbCrLf & "set
e_text=0" & vbCrLf & vbCrLf
mcstrErrText = "if errorlevel=1 Set has_err=1" & vbCrLf & "if errorlevel=1
set errors=[SEQ]" & vbCrLf & "if errorlevel=0 set e_text=%errors%" & vbCrLf
& vbCrLf
mcstrFooter = "set e_text=Error, Line %e_text%" & vbCrLf & vbCrLf & "if
%has_err%==0 set e_text=No Errors" & vbCrLf & vbCrLf & "cls" & vbCrLf &
"echo [REG]!" & vbCrLf & "echo %e_text%" & vbCrLf & "pause"
mlngPtr = 0
mlnghFileReg = 1
mlnghFileUReg = 2
If MsgBox("Create Un/Register Batch Files?", vbYesNo, "Dll Auto-Register") =
vbYes Then
Set mfso = CreateObject("Scripting.FileSystemObject")
Set mfd = mfso.GetFolder("C:\")
Set mRegStream = mfd.CreateTextFile("Register.bat", True, False)
Set mURegStream = mfd.CreateTextFile("UnRegister.bat", True, False)
mRegStream.Write Replace(mcstrHeader, "[REG]", "Registering")
mURegStream.Write Replace(mcstrHeader, "[REG]", "Un-Registering")
SetDllRegText "C:\Your Project\Dev\"
mRegStream.Write Replace(mcstrFooter, "[REG]", "Registered")
mURegStream.Write Replace(mcstrFooter, "[REG]", "Un-Registered")
mRegStream.Close
mURegStream.Close
MsgBox "Done.", vbOKOnly, "Dll Auto-Register"
End If
Private Sub SetDllRegText(ByVal strSearchPath)
Dim dr
Dim sfld
Dim f
Dim strPrintData
If Right(strSearchPath, 1) <> "\" Then strSearchPath = strSearchPath &
"\"
Set dr = mfso.GetFolder(strSearchPath)
For Each f In dr.Files
If Right(LCase(f.Name), 4) = ".dll" Or Right(LCase(f.Name), 4) =
".ocx" Then
mlngPtr = mlngPtr + 1
strPrintData = Replace(mcstrErrText, "[SEQ]", mlngPtr)
mRegStream.Write "regsvr32.exe " & """" & strSearchPath & f.Name
& """ /s" & vbCrLf & strPrintData
mURegStream.Write "regsvr32.exe /u " & """" & strSearchPath &
f.Name & """ /s" & vbCrLf & strPrintData
End If
Next
If dr.SubFolders.Count Then
For Each sfld In dr.SubFolders
If Err.Number Then Exit For
SetDllRegText sfld.Path
Next
End If
End Sub