Created
March 30, 2018 18:49
-
-
Save Rudokhvist/e6befa0c291c1d100e00ac1b650518ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set objFileSystem = CreateObject( "Scripting.FileSystemObject" ) | |
Set objTmplFile = objFileSystem.OpenTextFile(".\template.json",1) | |
strTmplText = objTmplFile.ReadAll() | |
objTmplFile.Close | |
Set objTmplFile = Nothing | |
Dim strLine | |
set objCurFolder = objFileSystem.getFolder( "." ) | |
set ArrayPassFiles = objCurFolder.Files | |
For Each objCurPassFile in ArrayPassFiles | |
If LCase(objFileSystem.GetExtensionName(objCurPassFile.Name)) = "txt" Then | |
Set objPassFile = objFileSystem.OpenTextFile(objCurPassFile.Name,1) | |
strLine = objPassFile.ReadLine() | |
filename=Left(objCurPassFile.Name,Len(objCurPassFile.Name)-3) & "json" | |
Set objFileToWrite = CreateObject("Scripting.FileSystemObject").OpenTextFile(filename,2,true) | |
credentials = Split (strLine,":") | |
strOutText = Replace (strTmplText,"%username%",credentials(0)) | |
strOutText = Replace (strOutText,"%password%",credentials(1)) | |
objFileToWrite.WriteLine(strOutText) | |
objFileToWrite.Close | |
Set objFileToWrite = Nothing | |
End If | |
next | |
objPassFile.Close | |
Set objPassFile = Nothing | |
MsgBox ("done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment