|
'----- ?????????: ??????? ????? ?????? ----------
|
|
|
|
const SMTP_Host = "post.kl.com" ' ????? SMTP-???????
|
|
const DB_Connection = "sys/jndthnrf1@KL" '?????? ?????????? ? ??
|
|
const SMTP_Subj = "????? dgmgrl" ' ???? ?????????
|
|
const SMTP_Port = 37725 ' ???? SMTP
|
|
const SMTP_Name = "Y3dtczMwMDBAcjc3LmtsLmNvbQ==" ' ????? ??? ????????
|
|
const SMTP_Password = "Q2tsYWQzMDAw" ' ?????? ??? ????????
|
|
const SMTP_From = "cwms3000@gk-kl.ru" ' ????? ???????????
|
|
const SMTP_To = "timoshenko_da@gk-kl.ru,gkkllogin@gk-kl.ru" ' ????? ??????????
|
|
const WaitCyclesCnt = 300 ' ???????? ? ???????? ?? ???????? ??????
|
|
'------------------------------------------------
|
|
|
|
const cdoSendUsingPort = 2
|
|
Const cdoBasic = 1
|
|
|
|
dim fso, fn, f, ff(), cnt
|
|
dim WshShell, oExec, input
|
|
|
|
set fso=createobject("Scripting.FileSystemObject")
|
|
Set WshShell = WScript.CreateObject("WScript.Shell")
|
|
|
|
Set oExec = WshShell.Exec("dgmgrl")
|
|
oExec.StdIn.Write "connect " & DB_Connection
|
|
oExec.StdIn.Write VbCrLf
|
|
oExec.StdIn.Write "show configuration;"
|
|
oExec.StdIn.Write VbCrLf
|
|
oExec.StdIn.Write "show database wms sendqentries;"
|
|
oExec.StdIn.Write VbCrLf
|
|
oExec.StdIn.Write "show database bwms recvqentries;"
|
|
oExec.StdIn.Write VbCrLf
|
|
oExec.StdIn.Write "exit;"
|
|
oExec.StdIn.Write VbCrLf
|
|
|
|
input = ""
|
|
|
|
|
|
|
|
Do While oExec.Status = 0
|
|
WScript.Sleep 100
|
|
Loop
|
|
|
|
Do While Not oExec.StdOut.AtEndOfStream
|
|
input = input & oExec.StdOut.Read(1)
|
|
Loop
|
|
|
|
|
|
|
|
'Set f = fso.GetFolder(fso.buildpath(Cons_Path, "attachment")).Files
|
|
|
|
' ???????? ?????? ??????
|
|
'for each fn in f
|
|
' if lcase(fso.getextensionname(fn))="txt" then
|
|
' AddToArray fn, ff, cnt
|
|
' end if
|
|
'next
|
|
|
|
|
|
|
|
' ???????? ??????
|
|
SendMessage SMTP_To, SMTP_Subj & " ?? " & Now, input, ff
|
|
|
|
' ???????? ??????
|
|
'for each fn in ff
|
|
' fso.deletefile fn
|
|
'next
|
|
|
|
|
|
'----------------
|
|
' ???????? ???????????? ??????
|
|
sub SendMessage(Recipient, Subj , Text, Attachments)
|
|
dim msg,fn
|
|
set msg = WScript.CreateObject("CDO.Message")
|
|
with msg
|
|
.BodyPart.charset = "KOI8-R"
|
|
.From = SMTP_From
|
|
.To = Recipient
|
|
.Subject = Subj
|
|
.TextBody = text
|
|
.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_Host
|
|
.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
|
|
.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTP_Port
|
|
.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTP_Name
|
|
.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTP_Password
|
|
.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoSMTPAuthenticate
|
|
.Configuration.Fields.Update
|
|
.MimeFormatted = true
|
|
for each fn in attachments
|
|
.addattachment fn
|
|
next
|
|
.Send
|
|
end with
|
|
end sub
|
|
|
|
'----------------
|
|
' ?????????? ???????? ? ??????
|
|
sub AddToArray(Itm, Arr, Count)
|
|
Count = Count + 1
|
|
ReDim Preserve Arr(Count-1)
|
|
Arr(Count-1) = Itm
|
|
end sub
|