Produced by Araxis Merge on 4/12/2018 10:18:34 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | MSSRe Build 4.zip\Applications\VACCR_CRS\VACCR | Logger.vbs | Tue Apr 10 19:45:41 2018 UTC |
| 2 | MSSRe Build 4.zip\Applications\VACCR_CRS\VACCR | Logger.vbs | Thu Apr 12 11:59:39 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 572 |
| Changed | 3 | 10 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | Option Exp licit | |
| 2 | ||
| 3 | 'SCRIPT PA RAMETERS | |
| 4 | 'NOTE: Th is script expects th at the par ent script also incl udes Globa lParms.vbs | |
| 5 | ' wher e database parameter s are defi ned | |
| 6 | 'Const con stExchange Server=" DNS " | |
| 7 | Const cons tExchangeS erver=" DNS " 'This se tting will allow sen ding e-mai ls outside VA | |
| 8 | Const cons tServerPor t= PORT | |
| 9 | ||
| 10 | Function f nLogEntry( sLogFile, sEntry, sE ntryType) | |
| 11 | '********* ********** ********** ********** ********** ********** ********** | |
| 12 | ' Purpose : Create s an entry in the sp ecified lo g file | |
| 13 | ' Paramete rs: sLog File - The name of the lo g file. Th e log will be | |
| 14 | ' create d if it do esn't exis t. However , this | |
| 15 | ' functi on will no t create n onexistent folders | |
| 16 | ' sEnt ry - Text tha t should b e logged | |
| 17 | ' sEnt ryType - Type o f log entr y that wil l be used as a | |
| 18 | ' error log entry marker, su ch as ERRO R or WARNI NG | |
| 19 | ' Returns: sResul t - Empty stri ng on succ ess, | |
| 20 | ' |- delimited string con taining th e error co de | |
| 21 | ' an d error de scription on failure . | |
| 22 | ' Revision History: | |
| 23 | ' 06/03/10 ZPG Origin al creatio n | |
| 24 | ' 07/22/10 ZPG 1. Restr uctured co de to ensu re object cleanup on premature function exits | |
| 25 | ' 2. Ren amed local object va riables to prevent s cope clash es | |
| 26 | '********* ********** ********** ********** ********** ********** ********** | |
| 27 | ||
| 28 | 'C onstants - working w ith text f iles | |
| 29 | Co nst ForRea ding = 1 | |
| 30 | Co nst ForWri ting = 2 | |
| 31 | Co nst ForApp ending = 8 | |
| 32 | ||
| 33 | Di m l_objFSO | |
| 34 | Di m l_objLog File | |
| 35 | Di m sText | |
| 36 | ||
| 37 | On Error Res ume Next | |
| 38 | ||
| 39 | Se t l_objFSO = CreateO bject("Scr ipting.Fil eSystemObj ect") | |
| 40 | ||
| 41 | Er r.Clear | |
| 42 | If l_objFSO. FileExists (sLogFile) Then | |
| 43 | Set l_objLogFi le = l_obj FSO.OpenTe xtFile(sLo gFile, For Appending, True) | |
| 44 | El se | |
| 45 | Set l_objLogFi le = l_obj FSO.Create TextFile(s LogFile, T rue) | |
| 46 | En d If | |
| 47 | ||
| 48 | If Err.Numbe r = 0 Then | |
| 49 | sTex t = Date & " " & Tim e | |
| 50 | sEnt ryType=Tri m(sEntryTy pe) | |
| 51 | If s EntryType= "" Then | |
| 52 | sText= sText & ": " | |
| 53 | Else | |
| 54 | sText= sText & " [" & sEntr yType & "] : " | |
| 55 | End If | |
| 56 | ||
| 57 | l_ob jLogFile.W riteLine(s Text & sEn try) | |
| 58 | If E rr.Number = 0 Then | |
| 59 | fnLogE ntry = "" | |
| 60 | Else 'Error writing a message t o the log | |
| 61 | fnLogE ntry = Err .Number & "|" & Err. Descriptio n | |
| 62 | End If | |
| 63 | El se 'Err or opening log file | |
| 64 | fnLo gEntry = E rr.Number & "|" & Er r.Descript ion | |
| 65 | En d If | |
| 66 | ||
| 67 | 'C lean up | |
| 68 | l_ objLogFile .Close | |
| 69 | Se t l_objLog File = Not hing | |
| 70 | Se t l_objFSO = Nothing | |
| 71 | ||
| 72 | End Functi on | |
| 73 | ||
| 74 | Function f nRaiseAler t(sSendToG roup, sSub ject, sMsg , arrAttac hments) | |
| 75 | '********* ********** ********** ********** ********** ********** ********** | |
| 76 | ' Purpose : Sends an e-mail alert | |
| 77 | ' Paramete rs: sSen dToGroup - ID of a group of alert rec ipients or groups de fined in | |
| 78 | ' or an e-mail add ress of a single rec ipient | |
| 79 | ' sSubject - Su bject of t he e-mail alert | |
| 80 | ' sMsg - Te xt that sh ould be se nt | |
| 81 | ' arrAttac hments - An array o f attachme nt file na mes | |
| 82 | ' or "" if no atta chments. | |
| 83 | ' If an attachment cannot be found, it will | |
| 84 | ' be lis ted in the body of t he e-mail | |
| 85 | ' Returns: sRes ult - Empty st ring on su ccess, | |
| 86 | ' |-delimi ted string containin g the erro r code | |
| 87 | ' and erro r descript ion on fai lure. | |
| 88 | ' Revision History: | |
| 89 | ' 06/03/10 ZPG Origin al creatio n | |
| 90 | ' 07/22/10 ZPG 1. Restr uctured co de to ensu re object cleanup on premature function exits | |
| 91 | ' 2. Renam ed local o bject vari ables to p revent sco pe clashes | |
| 92 | ' 3. Added local ADO constants | |
| 93 | ' 4. Added escape se quence for text save d in the d atabase to prevent S QL errors | |
| 94 | ' 07/27/10 ZPG Br oke out e- mail funct ion fnSend Email | |
| 95 | '********* ********** ********** ********** ********** ********** ********** | |
| 96 | ||
| 97 | 'C onstants - messaging | |
| 98 | Co nst cdoSen dUsingPick up = 1 | |
| 99 | Co nst cdoSen dUsingP ORT = P | |
| 100 | Co nst cdoAno nymous = 0 | |
| 101 | ||
| 102 | Di m sEscapeM sg | |
| 103 | Di m l_objCon n | |
| 104 | Di m l_objRS | |
| 105 | Di m sSQL | |
| 106 | Di m sDate | |
| 107 | Di m l_objMes sage | |
| 108 | Di m iCount | |
| 109 | Di m sRecipie nts | |
| 110 | Di m iNumberO fAttachmen ts | |
| 111 | Di m sMissing Attachment s | |
| 112 | Di m l_objFSO | |
| 113 | Di m iMissing Attachment s | |
| 114 | ||
| 115 | On Error Res ume Next | |
| 116 | ||
| 117 | 'R eplace sin gle and do uble quote s in the a lert text | |
| 118 | 't o prevent SQL errors in databa se searche s for that text | |
| 119 | sE scapeMsg = Replace(s Msg, Chr(3 4), "`") | |
| 120 | sE scapeMsg = Replace(s EscapeMsg, Chr(39), "`") | |
| 121 | sE scapeMsg = Replace(s EscapeMsg, Chr(124), ":") | |
| 122 | ||
| 123 | 'M ake sure a lert text is not too long | |
| 124 | If Len(sEsca peMsg) > 2 55 Then | |
| 125 | sEscap eMsg = Lef t(sEscapeM sg, 250) & "[...]" | |
| 126 | En d If | |
| 127 | ||
| 128 | 'E stablish D B connecti on | |
| 129 | Se t l_objCon n = Create Object("AD ODB.Connec tion") | |
| 130 | l_ objConn.Op en "Provid er=" & con stDBProvid er & "; Da ta Source= " & constD BName & "; " | |
| 131 | ||
| 132 | If Err.Numbe r = 0 Then | |
| 133 | Set l_objRS= C reateObjec t("ADODB.R ecordset") | |
| 134 | ||
| 135 | 'Mak e sure thi s alert ha sn't been sent yet | |
| 136 | sDat e=Date | |
| 137 | sDat e=Month(sD ate) & "/" & Day(sDa te) & "/" & Year(sDa te) 'Forma t current date to M/ D/YYYY | |
| 138 | sSQL ="SELECT * FROM Aler ts WHERE " | |
| 139 | sSQL =sSQL & "F eed_Name=' " & constF eedName & "' AND " | |
| 140 | sSQL =sSQL & "A lert_Date= #" & sDate & "# AND " | |
| 141 | sSQL =sSQL & "A lert_Text= '" & sEsca peMsg & "' ;" | |
| 142 | Err. Clear | |
| 143 | l_ob jRS.Cursor Location = adUseClie nt | |
| 144 | l_ob jRS.Open s SQL, l_obj Conn, adOp enStatic, adLockOpti mistic | |
| 145 | If E rr.Number = 0 Then | |
| 146 | If l_o bjRS.Recor dCount=0 T hen | |
| 147 | 'Record this alert so it wou ldn't be s ent again on the sam e day | |
| 148 | sSQL = " INSERT INT O Alerts ( Feed_Name, Alert_Dat e, Alert_T ext, Regis tered_Time stamp) " | |
| 149 | sSQL = s SQL & "VAL UES ('" & constFeedN ame & "', #" & sDate & "#, '" & sEscapeM sg & "', # " & Now & "#);" | |
| 150 | l_objCon n.Execute sSQL | |
| 151 | l_objRS. Close | |
| 152 | 'Send e- mail | |
| 153 | fnRaiseA lert = fnS endEmail(s SendToGrou p, sSubjec t, sMsg, a rrAttachme nts) | |
| 154 | Else 'Don't s end identi cal alerts the same day | |
| 155 | fnRaiseA lert = "" | |
| 156 | End If | |
| 157 | Else 'Error checking existing a lerts | |
| 158 | fnRais eAlert = E rr.Number & "|" & "C hecking ex isting ale rts: " & E rr.Descrip tion | |
| 159 | End If | |
| 160 | El se 'DB connection error | |
| 161 | fnRa iseAlert = Err.Numbe r & "|" & "Establish ing connec tion to " & constDBN ame & ": " & Err.Des cription | |
| 162 | En d If | |
| 163 | ||
| 164 | 'C leanup | |
| 165 | l_ objRS.Clos e | |
| 166 | Se t l_objRS = Nothing | |
| 167 | l_ objConn.Cl ose | |
| 168 | Se t l_objCon n = Nothin g | |
| 169 | Se t l_objMes sage = Not hing | |
| 170 | ||
| 171 | End Functi on | |
| 172 | ||
| 173 | Function f nSendEmail (sSendToGr oup, sSubj ect, sMsg, arrAttach ments) | |
| 174 | '********* ********** ********** ********** ********** ********** ********** | |
| 175 | ' Purpose : Sends an e-mail | |
| 176 | ' Paramete rs: sSen dToGroup - ID of a group of alert rec ipients or groups de fined in | |
| 177 | ' or an e-mail add ress of a single rec ipient | |
| 178 | ' sSubject - Su bject of t he e-mail alert | |
| 179 | ' sMsg - Te xt that sh ould be se nt | |
| 180 | ' arrAttac hments - An array o f attachme nt file na mes | |
| 181 | ' or "" if no atta chments. | |
| 182 | ' If an attachment cannot be found, it will | |
| 183 | ' be lis ted in the body of t he e-mail | |
| 184 | ' Returns: sRes ult - Empty st ring on su ccess, | |
| 185 | ' |-delimi ted string containin g the erro r code | |
| 186 | ' and erro r descript ion on fai lure. | |
| 187 | ' Revision History: | |
| 188 | ' 07/27/10 ZPG Origin al creatio n | |
| 189 | '********* ********** ********** ********** ********** ********** ********** | |
| 190 | ||
| 191 | 'C onstants - messaging | |
| 192 | Co nst cdoSen dUsingPick up = 1 | |
| 193 | Co nst cdoSen dUsingP ORT = P | |
| 194 | Co nst cdoAno nymous = 0 | |
| 195 | ||
| 196 | Di m l_objCon n | |
| 197 | Di m l_objRS | |
| 198 | Di m sSQL | |
| 199 | Di m l_objMes sage | |
| 200 | Di m iCount | |
| 201 | Di m sRecipie nts | |
| 202 | Di m iNumberO fAttachmen ts | |
| 203 | Di m sMissing Attachment s | |
| 204 | Di m iMissing Attachment s | |
| 205 | Di m l_objFSO | |
| 206 | ||
| 207 | On Error Res ume Next | |
| 208 | ||
| 209 | 'E stablish D B connecti on | |
| 210 | Se t l_objCon n = Create Object("AD ODB.Connec tion") | |
| 211 | l_ objConn.Op en "Provid er=" & con stDBProvid er & "; Da ta Source= " & constD BName & "; " | |
| 212 | Se t l_objRS= CreateObj ect("ADODB .Recordset ") | |
| 213 | If Err.Numbe r = 0 Then | |
| 214 | 'Get the list of recipie nts | |
| 215 | Err. Clear | |
| 216 | sSQL ="SELECT * FROM EMai l_Group_Me mbership W HERE Group _ID='" & s SendToGrou p & "';" | |
| 217 | l_ob jRS.Open s SQL, l_obj Conn, adOp enStatic, adLockOpti mistic | |
| 218 | If E rr.Number = 0 Then | |
| 219 | If l_o bjRS.Recor dCount > 0 Then | |
| 220 | l_objRS. MoveFirst | |
| 221 | Do While Not l_obj RS.EOF | |
| 222 | sRecipient s = sRecip ients & "; " & l_obj RS("User_E Mail") | |
| 223 | l_objRS.Mo veNext | |
| 224 | Loop | |
| 225 | sRecipie nts = Righ t(sRecipie nts, Len(s Recipients )-2) | |
| 226 | ||
| 227 | 'Create a Message object | |
| 228 | Set l_ob jMessage = CreateObj ect("CDO.M essage") | |
| 229 | ||
| 230 | l_objMes sage.Subje ct = sSubj ect | |
| 231 | l_objMes sage.From = constSen der | |
| 232 | l_objMes sage.To = sRecipient s | |
| 233 | ||
| 234 | 'Add att achments | |
| 235 | If Not a rrAttachme nts = "" A nd IsArray (arrAttach ments) The n | |
| 236 | Set l_objF SO = Creat eObject("S cripting.F ileSystemO bject") | |
| 237 | iNumberOfA ttachments =UBound(ar rAttachmen ts) | |
| 238 | For iCount = 0 To iN umberOfAtt achments | |
| 239 | If l_objFSO. FileExists (arrAttach ments(iCou nt)) Then | |
| 240 | Err. Clear | |
| 241 | l_ob jMessage.A ddAttachme nt arrAtta chments(iC ount) | |
| 242 | El se | |
| 243 | iMis singAttach ments = iM issingAtta chments + 1 | |
| 244 | sMis singAttach ments = sM issingAtta chments & vbLFCR & a rrAttachme nts(iCount ) | |
| 245 | En d If | |
| 246 | Next | |
| 247 | ||
| 248 | If iMissin gAttachmen ts > 0 The n | |
| 249 | If iMissingA ttachments > 1 Then | |
| 250 | sMis singAttach ments = vb LFCR & vbL FCR & "The following files wer e not atta ched becau se they we re not fou nd in the specified location:" & sMissin gAttachmen ts | |
| 251 | El se | |
| 252 | sMis singAttach ments = vb LFCR & vbL FCR & "The following file was not attach ed because it was no t found in the speci fied locat ion:" & sM issingAtta chments | |
| 253 | En d If | |
| 254 | sM sg = sMsg & sMissing Attachment s | |
| 255 | End If | |
| 256 | End If | |
| 257 | ||
| 258 | l_objMes sage.TextB ody = sMsg | |
| 259 | ||
| 260 | 'Set con figuration | |
| 261 | l_objMes sage.Confi guration.F ields("htt p://schema s.microsof t.com/cdo/ configurat ion/sendus ing") = cd oSendUsing Port | |
| 262 | l_objMes sage.Confi guration.F ields("htt p://schema s.microsof t.com/cdo/ configurat ion/smtpse rver") = c onstExchan geServer | |
| 263 | l_objMes sage.Confi guration.F ields("htt p://schema s.microsof t.com/cdo/ configurat ion/smtpse rverport") = constSe rverPort | |
| 264 | l_objMes sage.Confi guration.F ields("htt p://schema s.microsof t.com/cdo/ configurat ion/smtpau thenticate ") = cdoAn onymous | |
| 265 | l_objMes sage.Confi guration.F ields.Upda te | |
| 266 | ||
| 267 | l_objMes sage.Send | |
| 268 | If Err.N umber = 0 Then | |
| 269 | fnSendEmai l = "" | |
| 270 | Else | |
| 271 | fnSendEmai l = Err.Nu mber & "|" & "Sendin g the e-ma il: " & Er r.Descript ion | |
| 272 | End If | |
| 273 | Else ' Group of a lert recip ients has no associa ted member s | |
| 274 | fnSendEm ail = "0" & "|" & "G roup " & s SendToGrou p & " has no associa ted member s." | |
| 275 | End If | |
| 276 | Else 'Error getting t he list of recipient s | |
| 277 | fnSend Email = Er r.Number & "|" & "Re trieving t he list of recipient s: " & Err .Descripti on | |
| 278 | End If | |
| 279 | El se 'DB connection error | |
| 280 | fnSe ndEmail = Err.Number & "|" & " Establishi ng connect ion to " & constDBNa me & ": " & Err.Desc ription | |
| 281 | En d If | |
| 282 | ||
| 283 | 'C leanup | |
| 284 | l_ objRS.Clos e | |
| 285 | Se t l_objRS = Nothing | |
| 286 | l_ objConn.Cl ose | |
| 287 | Se t l_objCon n = Nothin g | |
| 288 | Se t l_objMes sage = Not hing | |
| 289 | Se t l_objFSO = Nothing | |
| 290 | ||
| 291 | End Functi on |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.