'se preia directorul aplicatiei Dim WshShell Set WshShell = WScript.CreateObject("WScript.Shell") Dim outFileWeb Dim outfWeb 'WScript.Echo directorAplicatie 'se citesc parametrii de apelare Set objArgs = WScript.Arguments For i = 0 to objArgs.Count - 1 WScript.Echo objArgs(i) Next caleDeLucru = objArgs(0) prefixCarte = objArgs(1) numarCarti = objArgs(2) coloanaVerset = objArgs(3) directorAplicatie = objArgs(4) adresaSite = objArgs(5) directorSite = objArgs(6) numeBiblie = objArgs(7) limbaTitluri = objArgs(8) aliniere = objArgs(9) unl = objArgs(10) servicii = objArgs(11) credits = objArgs(12) directorCarte = caleDeLucru '& "\" & prefixCarte directorCarteWeb = caleDeLucru & "\web\" & prefixCarte prefixCarte1 = Replace(prefixCarte, "\", "/") 'prefixCarte = Replace(prefixCarte, "\", "") nume = Replace(prefixCarte, "\", "_") & ".txt" ' & "Bible.txt" Dim fso, f1, ts, s Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Set fso = CreateObject("Scripting.FileSystemObject") If aliniere = "Right" Then Set outFile1 = fso.GetFile(directorAplicatie & "\web\" & "\index.php") Set outf1 = outFile1.OpenAsTextStream(ForReading, TristateUseDefault) index_php = outf1.ReadAll outf1.Close Set outFile1 = fso.GetFile(caleDeLucru & "\web\" & prefixCarte & "\index.php") Set outf1 = outFile1.OpenAsTextStream(ForWriting, TristateUseDefault) outf1.WriteLine Replace(index_php, "left", "right") outf1.Close End If 'Se citeste limba titlurilor pentru interfata web Redim cartiWeb(200) Set inFileTitluri = fso.GetFile(directorAplicatie & "\books\" & limbaTitluri & ".txt") Set infTitluri = inFileTitluri.OpenAsTextStream(ForReading, TristateUseDefault) MyString = infTitluri.ReadAll MyString = Replace(MyString, Chr(239) & Chr(187) & Chr(191), "") books = Split(MyString, vbCrLf) nrBooksTitluri = 0 For Each valoare in books If InStr(valoare,Chr(9)) Then book = Split(valoare,Chr(9)) If isNumeric(book(0)) Then cartiWeb(book(0)) = book(1) ' WScript.Echo carti(book(0)) & " " & book(0) nrBooksTitluri = nrBooksTitluri + 1 End If End If Next infTitluri.Close 'Sub conversion(nume, caleDeLucru, numarCarti) Dim nrBooksWeb nrBooksWeb = 0 Dim inFileConfigPHP, infConfigPHP, inFileIndexPHP, infIndexPHP, fileTitles fso.CreateTextFile directorCarteWeb & "\titles.txt" Set fileTitles = fso.GetFile(directorCarteWeb & "\titles.txt") Set fTitles = fileTitles.OpenAsTextStream(ForWriting, TristateUseDefault) Set inFileConfigPHP = fso.GetFile(directorCarteWeb & "\config.php") Set infConfigPHP = inFileConfigPHP.OpenAsTextStream(ForReading, TristateUseDefault) MyConfigPHP = infConfigPHP.ReadAll infConfigPHP.Close Set infConfigPHP = inFileConfigPHP.OpenAsTextStream(ForWriting, TristateUseDefault) MyConfigPHP = Replace(MyConfigPHP,"$CALE_SITE", adresaSite & "ebooks/www/" & prefixCarte1 & "/") MyConfigPHP = Replace(MyConfigPHP,"$CALE_DIRECTOR", directorSite & "www/" & prefixCarte1 & "/") MyConfigPHP = Replace(MyConfigPHP,"$NUME_BIBLIE", numeBiblie) infConfigPHP.WriteLine MyConfigPHP Dim MyString, MyArray, Msg Dim nrBooks nrBooks = 200 ReDim bookNames(nrBooks), bookNrChapters(nrBooks), bookShortNames(nrBooks) Redim carti(200) ' MsgBox directorAplicatie & "\books\" & limbaTitluri & ".txt" Set inFile = fso.GetFile(directorAplicatie & "\unl\" & unl) ' Set inFile = fso.GetFile(directorAplicatie & "\unl.txt") Set inf = inFile.OpenAsTextStream(ForReading, TristateUseDefault) MyString = inf.ReadAll MyString = Replace(MyString, Chr(239) & Chr(187) & Chr(191), "") books = Split(MyString, vbCrLf) nrBooks = 0 For Each valoare in books If InStr(valoare,Chr(9)) Then book = Split(valoare,Chr(9)) If isNumeric(book(0)) Then ' carti(book(0)) = book(1) nrBooks = nrBooks + 1 ' WScript.Echo carti(book(0)) & " " & book(0) bookID = book(0) bookName = book(1) bookShortName = book(2) bookNrChapter = book(3) bookNames(bookID) = bookName bookNrChapters(bookID) = bookNrChapter bookShortNames(bookID) = bookShortName WScript.Echo bookID & " " & bookNames(bookID) & " " & bookNrChapters(bookID) & " " & bookShortNames(bookID) End If End If Next inf.Close ' nume = Worksheets("Collections").Range("A5").Value fso.CreateTextFile directorCarte & "\" & prefixCarte & "\" & Replace(prefixCarte, "\", "_") & ".thml", True Set outFile = fso.GetFile(directorCarte & "\" & prefixCarte & "\" & Replace(prefixCarte, "\", "_") & ".thml") Set outf = outFile.OpenAsTextStream(ForWriting, TristateUseDefault) 'outF.Writeline "Hello World" 'outF.WriteBlankLines (1) WScript.Echo directorCarte & "\" & prefixCarte & "\" & nume Set inFile = fso.GetFile(directorCarte & "\" & prefixCarte & "\" & nume) Set inf = inFile.OpenAsTextStream(ForReading, TristateUseDefault) Msg = "" & vbCrLf _ & "" & vbCrLf & "" & vbCrLf & " " & vbCrLf & " " & vbCrLf _ & "" & vbCrLf _ & "

Holy Bible

" & vbCrLf _ & "

Romanian Translation

" Msg = Replace(Msg, "'", Chr(34)) outf.WriteLine Replace(Msg, "
", vbCr) semn = 0 bookIDAnte = 0 Do While Not inf.AtEndOfStream MyString = inf.ReadLine 'StdOut.WriteLine "Line " & (StdIn.Line - 1) & ": " & Str ' MyString = Replace(MyString, Chr(239), "") ' MyString = Replace(MyString, Chr(187), "") ' MyString = Replace(MyString, Chr(191), "") 'If InStr(1, MyString, "#") = 0 And MyString <> "" Then If Left(MyString, 1) <> "#" And MyString <> "" Then 'fara diacritice 'MyString = Replace(MyString, "ă", "a") 'MyString = Replace(MyString, "Ă", "A") 'MyString = Replace(MyString, "î", "i") 'MyString = Replace(MyString, "Î", "I") 'MyString = Replace(MyString, "â", "a") 'MyString = Replace(MyString, "Â", "A") 'MyString = Replace(MyString, "ş", "s") 'MyString = Replace(MyString, "Ş", "S") 'MyString = Replace(MyString, "ţ", "t") 'MyString = Replace(MyString, "Ţ", "T") MyArray = Split(MyString, Chr(9) & "", -1, 0) ' MyArray(0) contains Book number. ' MyArray(1) contains Chapter number. ' MyArray(2) contains Verse number. ' MyArray(3) contains Verse. MyArray(0) = Replace(MyArray(0), Chr(239) & Chr(187) & Chr(191), "") MyArray(0) = Replace(MyArray(0), "O", "") MyArray(0) = Replace(MyArray(0), "N", "") MyArray(0) = Replace(MyArray(0), "A", "") bookID = Int(MyArray(0)) chapterID = Int(MyArray(1)) verseID = Int(MyArray(2)) Verse = MyArray(coloanaVerset) prevbook = "" nextbook = "" prefbook = "" If verseID = 1 Then temp1 = bookShortNames(bookID) & "/" & chapterID & "/" & Replace(Verse, Chr(34), "'") & vbCrLf fTitles.Write Replace(temp1, "
","") End If If verseID = 1 Then If chapterID = 1 Then 'First chapter If bookID = 1 Then 'First chapter from Genesis prevbook = "i" nextbook = bookShortNames(bookID) & "." & (1) semn = 1 ElseIf bookID = numarCarti Then 'Revelation prevbook = bookShortNames(bookID - 1) & "." & bookNrChapters(bookID - 1) nextbook = "i" prefbook = "

" & vbCrLf & "" & vbCrLf & "" & vbCrLf semn = 1 Else 'Normal first chapter prevbook = bookShortNames(bookID - 1) & "." & bookNrChapters(bookID - 1) nextbook = bookShortNames(bookID) & "." & (1) prefbook = "

" & vbCrLf & "" & vbCrLf & "" & vbCrLf End If End If End If If semn = 0 Then prefbook = "" semn = 1 End If ' '

Geneza

If prevbook <> "" Then Msg = prefbook & "" & vbCrLf _ & "

" _ & bookNames(bookID) & "

" outf.WriteLine Replace(Msg, "
", vbCr) End If previtem = "" nextitem = "" prefitem = "" If verseID = 1 Then If chapterID = 1 Then 'First chapter If bookID = 1 Then 'First chapter from Genesis 'previtem = bookShortNames(66) & "." & bookNrChapters(66) previtem = bookShortNames(bookID) nextitem = bookShortNames(bookID) & "." & (chapterID + 1) ElseIf bookNrChapters(bookID) = 1 Then 'One chapter book 'previtem = bookShortNames(bookID - 1) & "." & bookNrChapters(bookID - 1) previtem = bookShortNames(bookID) nextitem = bookShortNames(bookID + 1) & "." & (1) Else 'Normal first chapter 'previtem = bookShortNames(bookID - 1) & "." & bookNrChapters(bookID - 1) previtem = bookShortNames(bookID) nextitem = bookShortNames(bookID) & "." & (chapterID + 1) End If ElseIf chapterID = bookNrChapters(bookID) Then 'Last chapter If bookID = Worksheets("Collections").Cells(6, 3).Value Then 'last chapter from Revelation previtem = bookShortNames(bookID) & "." & (chapterID - 1) 'nextitem = bookShortNames(1) & "." & (1) nextitem = "i" ' or put "toc" prefitem = "

" & vbCrLf & "" & vbCrLf Else 'last chapter from a book previtem = bookShortNames(bookID) & "." & (chapterID - 1) 'nextitem = bookShortNames(bookID + 1) & "." & (1) nextitem = bookShortNames(bookID + 1) prefitem = "

" & vbCrLf & "" & vbCrLf End If Else 'Normal chapter previtem = bookShortNames(bookID) & "." & (chapterID - 1) nextitem = bookShortNames(bookID) & "." & (chapterID + 1) prefitem = "

" & vbCrLf & "" & vbCrLf End If End If ' '

Chapter 1

'

If previtem <> "" Then Msg = prefitem & "" & vbCrLf _ & "

Chapter " _ & chapterID & "

" & vbCrLf _ & "

" outf.WriteLine Replace(Msg, "
", vbCr) End If ' '1La început, Dumnezeu a făcut cerurile şi pămîntul. Msg = "" & vbCrLf & " " _ & verseID & " " & Verse 'Msg = "" & vbCrLf & verse outf.WriteLine Replace(Msg, "
", vbCr) 'If verseID = 1 Then ' Msg = "

" & vbcrlf & "
" ' outF.Writeline Msg 'End If 'If verseID = 1 Then ' If chapterID = 1 Then ' ' Msg = "
" ' outF.Writeline Msg 'End If 'End If If bookID <> bookIDante Then If bookIDante <> 0 Then outfWeb.Close End If fso.CreateTextFile directorCarteWeb & "\" & bookShortNames(bookID), True Set outFileWeb = fso.GetFile(directorCarteWeb & "\" & bookShortNames(bookID)) Set outfWeb = outFileWeb.OpenAsTextStream(ForWriting, TristateUseDefault) For k = bookIDante + 1 To bookID - 1 infConfigPHP.WriteLine Replace("$bible_books[" & k - 1 & "]['long'] = '-'; $bible_books[" & k - 1 & "]['short'] = '-';", "'", Chr(34)) Next ' infConfigPHP.WriteLine Replace("$bible_books[" & nrBooksWeb & "]['long'] = '" & cartiWeb(bookID) & "'; $bible_books[" & nrBooksWeb & "]['short'] = '" & bookShortNames(bookID) &"';", "'", Chr(34)) infConfigPHP.WriteLine Replace("$bible_books[" & bookID - 1 & "]['long'] = '", "'", Chr(34)) & cartiWeb(bookID) & Replace("'; $bible_books[" & bookID - 1 & "]['short'] = '" & bookShortNames(bookID) &"';", "'", Chr(34)) nrBooksWeb = nrBooksWeb + 1 bookIDante = bookID End If outfWeb.WriteLine chapterID & ":" & verseID & " " & Verse End If ' Pentru interfata Web Loop prefbook = "
" & vbCrLf prefitem = "" & vbCrLf Msg = "

" & vbCrLf & prefitem & prefbook & "
" & vbCrLf & "
" & vbCrLf & "
" outf.WriteLine Replace(Msg, "
", vbCr) outf.Close inf.Close ' infConfigPHP.WriteLine "$numberBooks = " & nrBooksWeb & ";" infConfigPHP.WriteLine "$numberBooks = " & bookID & ";" infConfigPHP.WriteLine "//Services available for this module" & vbCrLf ' Se vor scrie serviciile service = "" For indexC = 1 To 14 Select Case indexC Case 1 service = "web" Case 2 service = "creator" Case 3 service = "phone" Case 4 service = "desktop" Case 5 service = "ipod" Case 6 service = "fontindependent" Case 7 service = "mobile" Case 8 service = "multilingual" Case 9 service = "mobiletext" Case 10 service = "jad" Case 11 service = "jar" Case 12 service = "jadcreator" Case 13 service = "jarcreator" Case 14 service = "other" Case Else End Select ' infConfigPHP.WriteLine Mid(servicii, indexC, 1) If Mid(servicii, indexC, 1) = "x" Then infConfigPHP.WriteLine Replace("$config_general['services']['" & service & "'] = TRUE;", "'", Chr(34)) End If If Mid(servicii, indexC, 1) = "0" Then infConfigPHP.WriteLine Replace("$config_general['services']['" & service & "'] = FALSE;", "'", Chr(34)) End If Next infConfigPHP.WriteLine vbCrLf & Replace("$config_general['credits'] = '" & credits & "'" & ";", "'", Chr(34)) infConfigPHP.WriteLine "?>" infConfigPHP.Close fTitles.Close 'End Sub 'Create folder cale de lucru /www/ prefix de carte ' Set fweb = fso.CreateFolder(caleDeLucru & "\www\") 'directorWebCarte = caleDeLucru & "\www\" & prefixCarte ' Set fweb = fso.CreateFolder(directorWebCarte) Set fs = CreateObject("Scripting.FileSystemObject") fs.CreateTextFile directorCarteWeb & "\numberOfVerses.txt", True Set outFile = fs.GetFile(directorCarteWeb & "\numberOfVerses.txt") Set outf = outFile.OpenAsTextStream(ForWriting, TristateUseDefault) offset = 0 signal = 0 For nrBooks1 = 1 To 200'nrBooks ' Wscript.Echo("Hello" & " " & nrBooks & " " & directorCarteWeb & "\" & bookShortNames(nrBooks1)) If (fs.FileExists(directorCarteWeb & "\" & bookShortNames(nrBooks1))) Then Wscript.Echo(bookShortNames(nrBooks1)) ' outf.Write nrBooks If nrBooks1 <> 1 And signal = 1 Then outf.Write Chr(9) & VerseIDante & "," & (offset - 2) offset = 0 outf.WriteLine "" End If signal = 1 outf.Write bookShortNames(nrBooks1) sg = 0 Set inFileBook = fs.GetFile(directorCarteWeb & "\" & bookShortNames(nrBooks1)) Set infBook = inFileBook.OpenAsTextStream(ForReading, TristateUseDefault) MyBook = infBook.ReadAll infBook.Close MyVerses = Split(MyBook, vbCrLf) ChapterIDprevious = "" nrVerse = 0 For Each MyVerse In MyVerses ' Wscript.Echo(MyVerse) l1 = InStr(MyVerse, ":") If l1 <> 0 Then l2 = InStr(l1, MyVerse, " ") ChapterID = Left(MyVerse, l1 - 1) VerseID = Trim(Mid(MyVerse, l1 + 1, l2 - l1)) Verse = Right(MyVerse, len(MyVerse) - l2) If ChapterID <> ChapterIDprevious Then ' Wscript.Echo(ChapterID & " " & VerseID & " " & Verse) Wscript.Echo(bookShortNames(nrBooks1) & " " & nrBooks1 & " " & ChapterID & " " & VerseIDante) ' If VerseIDante <> "" Then If sg = 0 Then sg = 1 Else outf.Write Chr(9) End If If nrVerse <> 0 Then outf.Write VerseIDante & "," & offset semn = 1 End If nrVerse = nrVerse + 1 ' End If ChapterIDprevious = ChapterID End If VerseIDante = VerseID End If offset = offset + Len(MyVerse) + 2 Next End If Next Wscript.Echo(ChapterID & " " & VerseIDante) outf.Write Chr(9) & VerseIDante & "," & (offset - 2) outf.Close