Jump to content

Recommended Posts

Posted (edited)

Hello people,

I made this script and I'ts not working like it should do.

Can any one help me fix this problem.

I'm not getting any output when i run this script. The only message I get is "Text File Made"

Manny manny thanks

Set WshShell = WScript.CreateObject("WScript.Shell") 
RunFolder = "C:\test123"
'InputBox("Please specify full Corsa installation folder. (Example: C:\test123)")
Filelist = "C:\Textfile.txt"
'Inputbox("Please specify text file name and destination dir. (Example: C:\Textfile.txt)")

strFolder = RunFolder

Set Fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = Fso.GetFolder(strFolder)
Set colFiles = objFolder.Files
Set TextFile = Fso.CreateTextFile(Filelist)

For Each objFile In colFiles
TextFile.WriteLine objFile.Path
Next

ShowSubFolders(objFolder)

Sub ShowSubFolders(objFolder)
Set colFolders = objFolder.SubFolders
For Each objSubFolder In colFolders
TextFile.WriteLine objSubFolder.Path
Set colFiles = objSubFolder.Files
For Each objFile In colFiles
TextFile.WriteLine objFile.Path
Next
ShowSubFolders(objSubFolder)
Next
End Sub
TextFile.Close
MsgBox "Text File Made"

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(Filelist, ForReading)
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("c:\art\Art.exe /s c:\art\ART_DB.rgf -a -b -f:exclude")

Do while not objFile.AtEndOfLine
strLine = objFile.ReadLine
i = 1
Extension = Right(strLine,i)
Do While (not (Left(Extension, 1) = ".")) and (i <= 5)
Extension = Right(strLine, i)
i = i + 1
loop
Extension = UCase(Extension)

if (Extension = ".OCX") or (Extension = ".DLL") then
i = 1
FileName = Right(strLine, i)
do while (not (left(strLine, 1) = "\"))
FileName = Right(strLine, i)
i = i + 1
loop
FileName = Right(strLine, i - 1)
FileName = Left(strLine, i - 5)

objShell.Run("regsvr32.exe /s " & strLine), 1, True
objShell.Run("c:\art\Art.exe /s c:\art\ART_DB.rgf -a -b -f:exclude")
objShell.Run("c:\art\art.exe /c c:\art\ART_DB.rgf -fr:c:\art\" & FileName & ".reg"), 1, True

else
if (Extension = ".EXE") then
i = 1
Filename = Right(strLine, i)
Do while (not (left(strLine, 1) = "\"))
FileName = Right(strLine,i)
i = i +1
loop
FileName = Right(strLine, i -1)
FileName = Left(strLine, i -5)

objShell.Run(strLine & "/REGSERVER"), 1, True
objShell.Run("c:\art\Art.exe /s c:\art\ART_DB.rgf -a -b -f:exclude")
objShell.Run("c:\art\art.exe /c c:\art\ART_DB.rgf -fr:c:\art\" & FileName & ".reg"), 1, True
end if
end if
loop

objFile.Close
MsgBox "OCX and DLL Files Are Registered In The Registry. Registry Back-ups Are Placed In C:\ari"

Edited by Volser

Posted
FileName = Right(strLine, i - 1)
FileName = Left(strLine, i - 5)

You have these two lines consecutive, which will pretty much make the first line useless. I'm not 100% sure what this script is trying to acheive other than I see it's using Elcomsoft's excellent registry change utility. The script itself I have to say, and I mean no offense if you wrote it, is terribly disorganized and doesn't follow good practices in many regards.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...