| Line-No. / Ref. | Code Line |
| 0001 | Public Function CopyReplace_TextStream(InFile, OutFile, NoteSubDirectory) |
| 0002 | 'This is a new module to read the html files and update the Notes directories |
| 0003 | 'It was based on http://www.tutorial-web.com/asp/fso/textstream |
| 0004 | Dim fso As FileSystemObject |
| 0005 | Dim tsTextFileIn As TextStream |
| 0006 | Dim tsTextFileOut As TextStream |
| 0007 | Dim strLine As String |
| 0008 | Dim MainFolder |
| 0009 | Dim FileCollection |
| 0010 | Dim File |
| 0011 | Set fso = CreateObject("Scripting.FileSystemObject") |
| 0012 | Set tsTextFileIn = fso.OpenTextFile(InFile, 1, False, 0) |
| 0013 | If Dir(OutFile) <> "" Then 'If we already have a file in the transfer directory, then zap it |
| 0014 | Kill OutFile |
| 0015 | End If |
| 0016 | Set tsTextFileOut = fso.CreateTextFile(OutFile, True, True) |
| 0017 | Do Until tsTextFileIn.AtEndOfStream |
| 0018 | strLine = tsTextFileIn.ReadLine |
| 0019 | 'Translate the line for Notes Links |
| 0020 | strLine = ReplaceNoteLink(strLine, "Notes_", "Notes_Print") |
| 0021 | 'Translate the line for Books Links (add an extra ../) |
| 0022 | strLine = ReplaceLink(strLine, "../BookSummaries", "../") |
| 0023 | 'Translate the line for Papers Links (add an extra ../) |
| 0024 | strLine = ReplaceLink(strLine, "../PaperSummaries", "../") |
| 0025 | tsTextFileOut.WriteLine strLine |
| 0026 | Loop |
| 0027 | End Function |
| Line-No. / Ref. | Code Line |
| 0001 | Public Sub CreateBookCitingsWebPages(Automatic) |
| 0002 | 'This is a new module to generate the pages that list the Books and Papers that (via my Abstract / Comments) cite a particular Book. |
| 0003 | 'It was based on Sub CreateAuthorsWebPages |
| 0004 | 'Called by WebpageBookCitings |
| 0005 | Dim fsoTextFile As FileSystemObject |
| 0006 | Dim tsTextFile As TextStream |
| 0007 | Dim rsTableToRead As Recordset |
| 0008 | Dim rsBooks As Recordset |
| 0009 | Dim rsTableControl As Recordset |
| 0010 | Dim strControlQuery As String |
| 0011 | Dim strLine As String |
| 0012 | Dim iTableColumns As Integer |
| 0013 | Dim iFieldNo As Integer |
| 0014 | Dim x As Integer |
| 0015 | Dim strQry As String |
| 0016 | Dim i As Integer |
| 0017 | Dim Book_ID As Integer |
| 0018 | Dim Book_ID_Previous As Integer |
| 0019 | Dim ObjectID As Integer |
| 0020 | Dim strFileSuffix As String |
| 0021 | Dim strFileBody As String |
| 0022 | Dim StartTime As Double |
| 0023 | Dim Time_Stamp As String |
| 0024 | Dim strAuthors As String |
| 0025 | Dim iCount As Long |
| 0026 | iCount = 0 |
| 0027 | Dim Saved_Link_Type As String |
| 0028 | Dim Saved_ObjectID As Integer |
| 0029 | Dim DoneEnough As Boolean |
| 0030 | Dim StrComma As String |
| 0031 | Dim iExtras As Integer |
| 0032 | Dim strName As String |
| 0033 | Set fsoTextFile = New FileSystemObject |
| 0034 | strFolder = strOutputFolder |
| 0035 | StartTime = Now() |
| 0036 | 'Read the data for Citations of this Book |
| 0037 | Set rsTableToRead = CurrentDb.OpenRecordset(strDataQuery) |
| 0038 | If Not rsTableToRead.EOF Then |
| 0039 | rsTableToRead.MoveFirst |
| 0040 | iTableColumns = rsTableToRead.Fields.Count |
| 0041 | 'Column 0 is the Book ID, anti-Penultimate Column is the Object ID, the Penultimate Column says whether it's a Book or a Paper; the last column is the position on the page |
| 0042 | Book_ID_Previous = 0 'There is no Book_ID 0 |
| 0043 | strFileSuffix = "" |
| 0044 | strFileBody = "" |
| 0045 | Do Until rsTableToRead.EOF |
| 0046 | Book_ID = rsTableToRead.Fields(0) |
| 0047 | ObjectID = rsTableToRead.Fields(iTableColumns - 3) |
| 0048 | If Book_ID_Previous <> Book_ID Then 'New Book |
| 0049 | 'Read the Book Author & Title |
| 0050 | strQry = "Select Books.Title, Books.Author from Books Where Books.ID1 = " & Book_ID & ";" |
| 0051 | Set rsBooks = CurrentDb.OpenRecordset(strQry) |
| 0052 | rsBooks.MoveFirst |
| 0053 | 'Write the previous Footer (except first time) |
| 0054 | If Book_ID_Previous <> 0 Then |
| 0055 | strControlQuery = "SELECT Website_Control.Line_Value FROM Website_Control WHERE (((Website_Control.Web_Page) = """ & strControlTable & """) And ((Website_Control.Section) = ""Footer"")) ORDER BY Website_Control.Line;" |
| 0056 | Set rsTableControl = CurrentDb.OpenRecordset(strControlQuery) |
| 0057 | rsTableControl.MoveFirst |
| 0058 | Do While Not rsTableControl.EOF |
| 0059 | Time_Stamp = rsTableControl.Fields(0) & "" |
| 0060 | OK = Replace_Timestamp(Time_Stamp) |
| 0061 | tsTextFile.WriteLine Time_Stamp |
| 0062 | rsTableControl.MoveNext |
| 0063 | Loop |
| 0064 | OK = CopyToTransfer(strFolder & strFileBody & "\", strFileSuffix & ".htm") |
| 0065 | iCount = iCount + 1 |
| 0066 | End If |
| 0067 | Book_ID_Previous = Book_ID |
| 0068 | strFileSuffix = strOutputFileShort & "_" & Book_ID |
| 0069 | strFileBody = "BookSummary_" & Mid(100000 + Book_ID, 2, 2) |
| 0070 | 'Create File |
| 0071 | Set tsTextFile = fsoTextFile.CreateTextFile(strOutputFolder & strFileBody & "\" & strFileSuffix & ".htm", True, True) |
| 0072 | 'Page Header |
| 0073 | strControlQuery = "SELECT Website_Control.Line_Value FROM Website_Control WHERE (((Website_Control.Web_Page) = """ & strControlTable & """) And ((Website_Control.Section) = ""Header"")) ORDER BY Website_Control.Line;" |
| 0074 | Set rsTableControl = CurrentDb.OpenRecordset(strControlQuery) |
| 0075 | rsTableControl.MoveFirst |
| 0076 | Do While Not rsTableControl.EOF |
| 0077 | strLine = rsTableControl.Fields(0) & "" |
| 0078 | x = InStr(1, strLine, "**BOOK**") |
| 0079 | If x > 0 Then |
| 0080 | 'Add the Book Title |
| 0081 | strLine = Left(strLine, x - 1) & "" & rsBooks.Fields(0).Value & "" & Mid(strLine, x + 8, Len(strLine)) |
| 0082 | End If |
| 0083 | x = InStr(1, strLine, "**AUTHOR**") |
| 0084 | If x > 0 Then |
| 0085 | 'Add the Book Author |
| 0086 | strAuthors = rsBooks.Fields(1) |
| 0087 | OK = Author_Reference_String(strAuthors, 2) |
| 0088 | strLine = Left(strLine, x - 1) & strAuthors & Mid(strLine, x + 10, Len(strLine)) |
| 0089 | End If |
| 0090 | tsTextFile.WriteLine strLine |
| 0091 | rsTableControl.MoveNext |
| 0092 | Loop |
| 0093 | 'Read Table-Control for rows |
| 0094 | strControlQuery = "SELECT Website_Control.Line_Value FROM Website_Control WHERE (((Website_Control.Web_Page) = """ & strControlTable & """) And ((Website_Control.Section) = ""Table_Row"")) ORDER BY Website_Control.Line;" |
| 0095 | Set rsTableControl = CurrentDb.OpenRecordset(strControlQuery) |
| 0096 | 'Table Column Headings |
| 0097 | rsTableControl.MoveFirst |
| 0098 | Do While Not rsTableControl.EOF |
| 0099 | If Left(rsTableControl.Fields(0), 8) = "**Column" Then |
| 0100 | iFieldNo = Val(Mid(rsTableControl.Fields(0), 9, 2)) |
| 0101 | 'Note: Fields start at 0, but the first one in the query is the Book ID, and the last two are the Object ID and the page-ref |
| 0102 | If iFieldNo > 0 And iFieldNo <= iTableColumns - 3 Then |
| 0103 | If iFieldNo = 6 Then |
| 0104 | tsTextFile.WriteLine " | Repeats ... | "
| 0105 | Else |
| 0106 | tsTextFile.WriteLine " " & rsTableToRead.Fields(iFieldNo).Name & "" |
| 0107 | End If |
| 0108 | End If |
| 0109 | Else |
| 0110 | tsTextFile.WriteLine rsTableControl.Fields(0) & "" |
| 0111 | End If |
| 0112 | rsTableControl.MoveNext |
| 0113 | Loop |
| 0114 | End If |
| 0115 | 'Table Row |
| 0116 | rsTableControl.MoveFirst |
| 0117 | Do While Not rsTableControl.EOF |
| 0118 | If Left(rsTableControl.Fields(0), 8) = "**Column" Then |
| 0119 | iFieldNo = Val(Mid(rsTableControl.Fields(0), 9, 2)) |
| 0120 | If iFieldNo > 0 And iFieldNo <= iTableColumns - 2 Then |
| 0121 | If Len(rsTableToRead.Fields(iFieldNo) & "") = 0 Then |
| 0122 | strLine = " " |
| 0123 | Else |
| 0124 | Select Case rsTableToRead.Fields(iFieldNo).Name |
| 0125 | Case "Title" |
| 0126 | If rsTableToRead.Fields(5).Value = "." Then 'No further information |
| 0127 | strLine = rsTableToRead.Fields(iFieldNo).Value |
| 0128 | Else |
| 0129 | If rsTableToRead.Fields(iTableColumns - 2) = "Paper" Then |
| 0130 | strLine = "" & rsTableToRead.Fields(iFieldNo).Value & "" |
| 0131 | Else |
| 0132 | strLine = "" & rsTableToRead.Fields(iFieldNo).Value & "" |
| 0133 | End If |
| 0134 | End If |
| 0135 | Case "Further Information" |
| 0136 | strName = "B" & Book_ID & "_" & rsTableToRead.Fields(iTableColumns - 1) |
| 0137 | Saved_Link_Type = rsTableToRead.Fields(iTableColumns - 2) |
| 0138 | Saved_ObjectID = ObjectID |
| 0139 | If rsTableToRead.Fields(iFieldNo).Value = "." Then |
| 0140 | If Saved_Link_Type = "Paper" Then |
| 0141 | strLine = "Paper | | "
| 0142 | Else |
| 0143 | strLine = "Book | | "
| 0144 | End If |
| 0145 | Else |
| 0146 | If Saved_Link_Type = "Paper" Then |
| 0147 | strLine = "Paper Abstract" |
| 0148 | Else |
| 0149 | strLine = "Book Abstract" |
| 0150 | End If |
| 0151 | strLine = strLine & rsTableToRead.Fields(iFieldNo).Value & " | "
| 0152 | rsTableToRead.MoveNext |
| 0153 | DoneEnough = False |
| 0154 | If Not rsTableToRead.EOF Then |
| 0155 | strLine = strLine & "| " | |
| 0156 | StrComma = "" |
| 0157 | iExtras = 1 |
| 0158 | Do Until DoneEnough = True |
| 0159 | If Saved_Link_Type = rsTableToRead.Fields(iTableColumns - 2) And ObjectID = rsTableToRead.Fields(iTableColumns - 3) And Book_ID = rsTableToRead.Fields(0) Then |
| 0160 | If Saved_Link_Type = "Paper" Then |
| 0161 | strLine = strLine & StrComma & "" & iExtras & "" |
| 0162 | Else |
| 0163 | strLine = strLine & StrComma & "" & iExtras & "" |
| 0164 | End If |
| 0165 | rsTableToRead.MoveNext |
| 0166 | If rsTableToRead.EOF Then |
| 0167 | DoneEnough = True |
| 0168 | rsTableToRead.MovePrevious |
| 0169 | Else |
| 0170 | StrComma = ", " |
| 0171 | iExtras = iExtras + 1 |
| 0172 | End If |
| 0173 | Else |
| 0174 | DoneEnough = True |
| 0175 | rsTableToRead.MovePrevious |
| 0176 | End If |
| 0177 | Loop |
| 0178 | strLine = strLine & " | "
| 0179 | Else |
| 0180 | strLine = strLine & "| | " |
| 0181 | rsTableToRead.MovePrevious |
| 0182 | End If |
| 0183 | End If |
| 0184 | Case Else |
| 0185 | If iFieldNo = 6 Then |
| 0186 | strLine = "" |
| 0187 | Else |
| 0188 | strLine = rsTableToRead.Fields(iFieldNo) |
| 0189 | End If |
| 0190 | End Select |
| 0191 | End If |
| 0192 | strLine = ReplaceCode(strLine, Chr(13) & Chr(10), " ") |
| 0193 | tsTextFile.WriteLine strLine |
| 0194 | End If |
| 0195 | Else |
| 0196 | tsTextFile.WriteLine rsTableControl.Fields(0) & "" |
| 0197 | End If |
| 0198 | rsTableControl.MoveNext |
| 0199 | Loop |
| 0200 | rsTableToRead.MoveNext |
| 0201 | Loop |
| 0202 | 'Write the Last Footer |
| 0203 | strControlQuery = "SELECT Website_Control.Line_Value FROM Website_Control WHERE (((Website_Control.Web_Page) = """ & strControlTable & """) And ((Website_Control.Section) = ""Footer"")) ORDER BY Website_Control.Line;" |
| 0204 | Set rsTableControl = CurrentDb.OpenRecordset(strControlQuery) |
| 0205 | rsTableControl.MoveFirst |
| 0206 | Do While Not rsTableControl.EOF |
| 0207 | Time_Stamp = rsTableControl.Fields(0) & "" |
| 0208 | OK = Replace_Timestamp(Time_Stamp) |
| 0209 | tsTextFile.WriteLine Time_Stamp |
| 0210 | rsTableControl.MoveNext |
| 0211 | Loop |
| 0212 | OK = CopyToTransfer(strFolder & strFileBody & "\", strFileSuffix & ".htm") |
| 0213 | iCount = iCount + 1 |
| 0214 | End If |
| 0215 | If Automatic = "No" Then |
| 0216 | MsgBox strOutputFile & "Book to Citing Book / Paper Links Creation Complete, in " & Round((Now() - StartTime) * 24 * 60, 1) & " minutes. " & iCount & " pages output.", vbOKOnly, "Create Book Citation Pages" |
| 0217 | End If |
| 0218 | End Sub |
| Line-No. / Ref. | Code Line |
| 0001 | Public Sub CreatePaperCitingsWebPages(Automatic) |
| 0002 | 'This is a new module to generate the pages that list the Books and Papers that (via my Abstract / Comments) cite a particular Paper. |
| 0003 | 'It was based on Sub CreateAuthorsWebPages |
| 0004 | 'Called by WebpagePaperCitings |
| 0005 | Dim fsoTextFile As FileSystemObject |
| 0006 | Dim tsTextFile As TextStream |
| 0007 | Dim rsTableToRead As Recordset |
| 0008 | Dim rsPapers As Recordset |
| 0009 | Dim rsTableControl As Recordset |
| 0010 | Dim strControlQuery As String |
| 0011 | Dim strLine As String |
| 0012 | Dim iTableColumns As Integer |
| 0013 | Dim iFieldNo As Integer |
| 0014 | Dim x As Integer |
| 0015 | Dim strQry As String |
| 0016 | Dim i As Integer |
| 0017 | Dim Paper_ID As Integer |
| 0018 | Dim Paper_ID_Previous As Integer |
| 0019 | Dim ObjectID As Integer |
| 0020 | Dim strFileSuffix As String |
| 0021 | Dim strFileBody As String |
| 0022 | Dim StartTime As Double |
| 0023 | Dim Time_Stamp As String |
| 0024 | Dim strAuthors As String |
| 0025 | Dim strPaper As String |
| 0026 | Dim iCount As Long |
| 0027 | Dim strName As String |
| 0028 | iCount = 0 |
| 0029 | Set fsoTextFile = New FileSystemObject |
| 0030 | strFolder = strOutputFolder |
| 0031 | StartTime = Now() |
| 0032 | 'Read the data for Citations of this Paper |
| 0033 | Set rsTableToRead = CurrentDb.OpenRecordset(strDataQuery) |
| 0034 | If Not rsTableToRead.EOF Then |
| 0035 | rsTableToRead.MoveFirst |
| 0036 | iTableColumns = rsTableToRead.Fields.Count |
| 0037 | 'Column 0 is the Paper ID, Anti-Penultimate Column is the Object ID, the Penultimate Column says whether it's a Book or a Paper; the last column is the reference on the page |
| 0038 | Paper_ID_Previous = 0 'There is no Paper_ID 0 |
| 0039 | strFileSuffix = "" |
| 0040 | strFileBody = "" |
| 0041 | Do Until rsTableToRead.EOF |
| 0042 | Paper_ID = rsTableToRead.Fields(0) |
| 0043 | ObjectID = rsTableToRead.Fields(iTableColumns - 3) |
| 0044 | If Paper_ID_Previous <> Paper_ID Then 'New Paper |
| 0045 | 'Read the Paper Author & Title |
| 0046 | strQry = "Select Papers.Title, Papers.Author from Papers Where Papers.ID = " & Paper_ID & ";" |
| 0047 | Set rsPapers = CurrentDb.OpenRecordset(strQry) |
| 0048 | If Not rsPapers.EOF Then |
| 0049 | rsPapers.MoveFirst |
| 0050 | strAuthors = rsPapers.Fields(1) |
| 0051 | strPaper = rsPapers.Fields(0) |
| 0052 | Else |
| 0053 | strAuthors = "Unknown Author" |
| 0054 | strPaper = "Unknown Paper" |
| 0055 | End If |
| 0056 | 'Write the previous Footer (except first time) |
| 0057 | If Paper_ID_Previous <> 0 Then |
| 0058 | strControlQuery = "SELECT Website_Control.Line_Value FROM Website_Control WHERE (((Website_Control.Web_Page) = """ & strControlTable & """) And ((Website_Control.Section) = ""Footer"")) ORDER BY Website_Control.Line;" |
| 0059 | Set rsTableControl = CurrentDb.OpenRecordset(strControlQuery) |
| 0060 | rsTableControl.MoveFirst |
| 0061 | Do While Not rsTableControl.EOF |
| 0062 | Time_Stamp = rsTableControl.Fields(0) & "" |
| 0063 | OK = Replace_Timestamp(Time_Stamp) |
| 0064 | tsTextFile.WriteLine Time_Stamp |
| 0065 | rsTableControl.MoveNext |
| 0066 | Loop |
| 0067 | OK = CopyToTransfer(strFolder & strFileBody & "\", strFileSuffix & ".htm") |
| 0068 | iCount = iCount + 1 |
| 0069 | End If |
| 0070 | Paper_ID_Previous = Paper_ID |
| 0071 | strFileSuffix = strOutputFileShort & "_" & Paper_ID |
| 0072 | strFileBody = "PaperSummary_" & Mid(100000 + Paper_ID, 2, 2) |
| 0073 | 'Create File |
| 0074 | Set tsTextFile = fsoTextFile.CreateTextFile(strOutputFolder & strFileBody & "\" & strFileSuffix & ".htm", True, True) |
| 0075 | 'Page Header |
| 0076 | strControlQuery = "SELECT Website_Control.Line_Value FROM Website_Control WHERE (((Website_Control.Web_Page) = """ & strControlTable & """) And ((Website_Control.Section) = ""Header"")) ORDER BY Website_Control.Line;" |
| 0077 | Set rsTableControl = CurrentDb.OpenRecordset(strControlQuery) |
| 0078 | rsTableControl.MoveFirst |
| 0079 | Do While Not rsTableControl.EOF |
| 0080 | strLine = rsTableControl.Fields(0) & "" |
| 0081 | x = InStr(1, strLine, "**PAPER**") |
| 0082 | If x > 0 Then |
| 0083 | 'Add the Paper Title |
| 0084 | strLine = Left(strLine, x - 1) & "" & strPaper & "" & Mid(strLine, x + 9, Len(strLine)) |
| 0085 | End If |
| 0086 | x = InStr(1, strLine, "**AUTHOR**") |
| 0087 | If x > 0 Then |
| 0088 | 'Add the Paper Author |
| 0089 | OK = Author_Reference_String(strAuthors, 2) |
| 0090 | strLine = Left(strLine, x - 1) & strAuthors & Mid(strLine, x + 10, Len(strLine)) |
| 0091 | End If |
| 0092 | tsTextFile.WriteLine strLine |
| 0093 | rsTableControl.MoveNext |
| 0094 | Loop |
| 0095 | 'Read Table-Control for rows |
| 0096 | strControlQuery = "SELECT Website_Control.Line_Value FROM Website_Control WHERE (((Website_Control.Web_Page) = """ & strControlTable & """) And ((Website_Control.Section) = ""Table_Row"")) ORDER BY Website_Control.Line;" |
| 0097 | Set rsTableControl = CurrentDb.OpenRecordset(strControlQuery) |
| 0098 | 'Table Column Headings |
| 0099 | rsTableControl.MoveFirst |
| 0100 | Do While Not rsTableControl.EOF |
| 0101 | If Left(rsTableControl.Fields(0), 8) = "**Column" Then |
| 0102 | iFieldNo = Val(Mid(rsTableControl.Fields(0), 9, 2)) |
| 0103 | 'Note: Fields start at 0, but the first one in the query is the Paper, and the last one is the Object ID |
| 0104 | If iFieldNo > 0 And iFieldNo <= iTableColumns - 2 Then |
| 0105 | tsTextFile.WriteLine " " & rsTableToRead.Fields(iFieldNo).Name & "" |
| 0106 | End If |
| 0107 | Else |
| 0108 | tsTextFile.WriteLine rsTableControl.Fields(0) & "" |
| 0109 | End If |
| 0110 | rsTableControl.MoveNext |
| 0111 | Loop |
| 0112 | End If |
| 0113 | 'Table Row |
| 0114 | rsTableControl.MoveFirst |
| 0115 | Do While Not rsTableControl.EOF |
| 0116 | If Left(rsTableControl.Fields(0), 8) = "**Column" Then |
| 0117 | iFieldNo = Val(Mid(rsTableControl.Fields(0), 9, 2)) |
| 0118 | If iFieldNo > 0 And iFieldNo <= iTableColumns - 2 Then |
| 0119 | If Len(rsTableToRead.Fields(iFieldNo) & "") = 0 Then |
| 0120 | strLine = " " |
| 0121 | Else |
| 0122 | Select Case rsTableToRead.Fields(iFieldNo).Name |
| 0123 | Case "Title" |
| 0124 | If rsTableToRead.Fields(5).Value <> "." Then |
| 0125 | If rsTableToRead.Fields(iTableColumns - 2) = "Paper" Then |
| 0126 | strLine = "" & rsTableToRead.Fields(iFieldNo) & "" |
| 0127 | Else |
| 0128 | strLine = "" & rsTableToRead.Fields(iFieldNo) & "" |
| 0129 | End If |
| 0130 | Else |
| 0131 | strLine = rsTableToRead.Fields(iFieldNo) |
| 0132 | End If |
| 0133 | Case "Further Information" |
| 0134 | If rsTableToRead.Fields(iFieldNo).Value = "." Then |
| 0135 | If rsTableToRead.Fields(iTableColumns - 2) = "Paper" Then |
| 0136 | strLine = "Paper" |
| 0137 | Else |
| 0138 | strLine = "Book" |
| 0139 | End If |
| 0140 | Else |
| 0141 | strName = "P" & Paper_ID & "_" & rsTableToRead.Fields(iTableColumns - 1) |
| 0142 | If rsTableToRead.Fields(iTableColumns - 2) = "Paper" Then |
| 0143 | strLine = "Paper Abstract" |
| 0144 | Else |
| 0145 | strLine = "Book Abstract" |
| 0146 | End If |
| 0147 | strLine = strLine & rsTableToRead.Fields(iFieldNo).Value |
| 0148 | End If |
| 0149 | Case Else |
| 0150 | strLine = rsTableToRead.Fields(iFieldNo) |
| 0151 | End Select |
| 0152 | End If |
| 0153 | strLine = ReplaceCode(strLine, Chr(13) & Chr(10), " ") |
| 0154 | tsTextFile.WriteLine strLine |
| 0155 | End If |
| 0156 | Else |
| 0157 | tsTextFile.WriteLine rsTableControl.Fields(0) & "" |
| 0158 | End If |
| 0159 | rsTableControl.MoveNext |
| 0160 | Loop |
| 0161 | rsTableToRead.MoveNext |
| 0162 | Loop |
| 0163 | 'Write the Last Footer |
| 0164 | strControlQuery = "SELECT Website_Control.Line_Value FROM Website_Control WHERE (((Website_Control.Web_Page) = """ & strControlTable & """) And ((Website_Control.Section) = ""Footer"")) ORDER BY Website_Control.Line;" |
| 0165 | Set rsTableControl = CurrentDb.OpenRecordset(strControlQuery) |
| 0166 | rsTableControl.MoveFirst |
| 0167 | Do While Not rsTableControl.EOF |
| 0168 | Time_Stamp = rsTableControl.Fields(0) & "" |
| 0169 | OK = Replace_Timestamp(Time_Stamp) |
| 0170 | tsTextFile.WriteLine Time_Stamp |
| 0171 | rsTableControl.MoveNext |
| 0172 | Loop |
| 0173 | OK = CopyToTransfer(strFolder & strFileBody & "\", strFileSuffix & ".htm") |
| 0174 | iCount = iCount + 1 |
| 0175 | End If |
| 0176 | If Automatic = "No" Then |
| 0177 | MsgBox strOutputFile & "Paper to Citing Book / Paper Links Creation Complete, in " & Round((Now() - StartTime) * 24 * 60, 1) & " minutes. " & iCount & " pages output.", vbOKOnly, "Create Paper Citation Pages" |
| 0178 | End If |
| 0179 | End Sub |
| Line-No. / Ref. | Code Line |
| 0001 | Public Sub Notes_Move_Control() |
| 0002 | 'This is a new module to read the html files and update the Notes directories |
| 0003 | 'It was based on http://www.tutorial-web.com/asp/fso/textstream |
| 0004 | 'Needs to run twice for secure and open Notes |
| 0005 | Dim fso As FileSystemObject |
| 0006 | Dim tsTextFileIn As TextStream |
| 0007 | Dim InFile As String |
| 0008 | Dim DirectoryName As String |
| 0009 | Dim MainFolder |
| 0010 | Dim FileCollection |
| 0011 | Dim File |
| 0012 | Dim File_Name As String |
| 0013 | Dim Note_ID As String |
| 0014 | Dim New_Directory As String |
| 0015 | Dim New_File_Name As String |
| 0016 | Set fso = CreateObject("Scripting.FileSystemObject") |
| 0017 | DirectoryName = TheoWebsiteRoot & "\Secure_Jen\" |
| 0018 | Set MainFolder = fso.GetFolder(DirectoryName) |
| 0019 | Set FileCollection = MainFolder.Files |
| 0020 | For Each File In FileCollection |
| 0021 | File_Name = File.Name |
| 0022 | Note_ID = Find_NoteID(File_Name) 'Determine Note_ID |
| 0023 | If Note_ID = "" Then |
| 0024 | Debug.Print Now() & " - "; "ID not Found" |
| 0025 | Else |
| 0026 | InFile = DirectoryName & File_Name |
| 0027 | Set tsTextFileIn = fso.OpenTextFile(InFile, 1, False, 0) 'Open the file |
| 0028 | New_Directory = "Notes_" & Find_New_Directory(Note_ID) 'Determine New Folder |
| 0029 | New_File_Name = DirectoryName & New_Directory & "\" & File_Name |
| 0030 | New_Directory = New_Directory & "/" |
| 0031 | 'Convert the references in the file (copying as we go) |
| 0032 | OK = CopyReplace_TextStream(InFile, New_File_Name, New_Directory) |
| 0033 | Set tsTextFileIn = Nothing |
| 0034 | End If |
| 0035 | Next |
| 0036 | Set fso = Nothing |
| 0037 | End Sub |
| Line-No. / Ref. | Code Line |
| 0001 | Public Sub Notes_Print_Move_Control() |
| 0002 | 'This is a new module to read the html files and update the Notes directories |
| 0003 | 'It was based on http://www.tutorial-web.com/asp/fso/textstream |
| 0004 | 'Needs to run twice for secure and open Notes |
| 0005 | Dim fso As FileSystemObject |
| 0006 | Dim tsTextFileIn As TextStream |
| 0007 | Dim InFile As String |
| 0008 | Dim DirectoryName As String |
| 0009 | Dim SubDirectoryName As String |
| 0010 | Dim MainFolder |
| 0011 | Dim FileCollection |
| 0012 | Dim File |
| 0013 | Dim File_Name As String |
| 0014 | Dim Note_ID As String |
| 0015 | Dim New_Directory As String |
| 0016 | Dim New_File_Name As String |
| 0017 | Set fso = CreateObject("Scripting.FileSystemObject") |
| 0018 | DirectoryName = TheoWebsiteRoot & "\Notes\" |
| 0019 | SubDirectoryName = "Notes_Print\" |
| 0020 | Set MainFolder = fso.GetFolder(DirectoryName & SubDirectoryName) |
| 0021 | Set FileCollection = MainFolder.Files |
| 0022 | For Each File In FileCollection |
| 0023 | File_Name = File.Name |
| 0024 | Note_ID = Find_NoteID_Print(File_Name) 'Determine Note_ID |
| 0025 | If Note_ID = "" Then |
| 0026 | Debug.Print Now() & " - "; "ID not Found" |
| 0027 | Else |
| 0028 | InFile = DirectoryName & SubDirectoryName & File_Name |
| 0029 | Set tsTextFileIn = fso.OpenTextFile(InFile, 1, False, 0) 'Open the file |
| 0030 | New_Directory = "Notes_" & Find_New_Directory(Note_ID) 'Determine New Folder |
| 0031 | New_File_Name = DirectoryName & New_Directory & "\" & SubDirectoryName & File_Name |
| 0032 | New_Directory = New_Directory & "/" |
| 0033 | 'Convert the references in the file (copying as we go) |
| 0034 | OK = CopyReplace_TextStreamPrint(InFile, New_File_Name) |
| 0035 | Set tsTextFileIn = Nothing |
| 0036 | End If |
| 0037 | Next |
| 0038 | Set fso = Nothing |
| 0039 | End Sub |
| Line-No. / Ref. | Code Line |
| 0001 | Public Function ReplaceNoteLink(strString, Marker, Ignore_String) |
| 0002 | 'This module adds Pre_Addition pror to Marker anywhere in strString, provided Ignore_String doesn't start in the same place as Marker |
| 0003 | 'The primary usage is to convert references in Notes consequent on adding an extra level of directory structure |
| 0004 | Dim lenString As Long |
| 0005 | Dim lenMarker As Long |
| 0006 | Dim lenPre As Long |
| 0007 | Dim lenIgn As Long |
| 0008 | Dim strTemp As String |
| 0009 | Dim x As Long |
| 0010 | Dim Y As Long |
| 0011 | Dim NoteID As String |
| 0012 | Dim Pre_Addition As String |
| 0013 | Dim len_PreRemoval As Long |
| 0014 | strTemp = strString |
| 0015 | lenString = Len(strTemp) |
| 0016 | lenMarker = Len(Marker) |
| 0017 | lenIgn = Len(Ignore_String) |
| 0018 | x = 1 |
| 0019 | Y = 1 |
| 0020 | Do While Y > 0 |
| 0021 | Y = InStr(x, strTemp, Marker) |
| 0022 | If Y > 0 Then |
| 0023 | If Mid(strTemp, Y, lenIgn) = Ignore_String Then |
| 0024 | x = Y + 1 |
| 0025 | Else |
| 0026 | 'Need to determine the right sub-directory |
| 0027 | NoteID = Find_NoteID2(Mid(strTemp, Y, Len(strTemp))) |
| 0028 | If NoteID <> "" Then |
| 0029 | 'Check if a cross-security link |
| 0030 | If Right(Left(strTemp, Y - 1), 9) = "../Notes/" Then |
| 0031 | Pre_Addition = "../../Notes/" |
| 0032 | len_PreRemoval = 9 |
| 0033 | Else |
| 0034 | If Right(Left(strTemp, Y - 1), 14) = "../Secure_Jen/" Then |
| 0035 | Pre_Addition = "../../Secure_Jen/" |
| 0036 | len_PreRemoval = 14 |
| 0037 | Else |
| 0038 | Pre_Addition = "../" |
| 0039 | len_PreRemoval = 0 |
| 0040 | End If |
| 0041 | End If |
| 0042 | Pre_Addition = Pre_Addition & "Notes_" & Find_New_Directory(NoteID) & "/" |
| 0043 | Else |
| 0044 | Pre_Addition = "" |
| 0045 | len_PreRemoval = 0 |
| 0046 | End If |
| 0047 | lenPre = Len(Pre_Addition) |
| 0048 | 'Adjust the string |
| 0049 | strTemp = Left(strTemp, Y - 1 - len_PreRemoval) & Pre_Addition & Mid(strTemp, Y, lenString) |
| 0050 | lenString = Len(strTemp) |
| 0051 | x = Y - len_PreRemoval + lenPre + 1 |
| 0052 | End If |
| 0053 | End If |
| 0054 | Loop |
| 0055 | ReplaceNoteLink = strTemp |
| 0056 | End Function |