Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


Код: Выделить весь код
Option Explicit

Const READYSTATE_COMPLETE = 4

Dim objHTMLElementCollection, objHTMLElementCollection2


With WScript.CreateObject("InternetExplorer.Application")
	.Visible = False
	.Navigate("http://imm.hldns.ru/")
	
	Do
		WScript.Sleep 100
	Loop Until Not .Busy And .ReadyState = READYSTATE_COMPLETE
	
	Set objHTMLElementCollection = .document.getElementsByClassName("num3")
	
	If Not objHTMLElementCollection Is Nothing Then
		Set objHTMLElementCollection2 = objHTMLElementCollection.item(0).getElementsByClassName("value")
		
		If Not objHTMLElementCollection2 Is Nothing Then
			If Not StrComp(objHTMLElementCollection2.item(0).innerText, "100", vbTextCompare) = 0 Then
				SendMessage
			End If
			
			Set objHTMLElementCollection2 = Nothing
		Else
			WScript.Echo "Can't parse elements with [value] class name."
		End If
		
		Set objHTMLElementCollection = Nothing
	Else
		WScript.Echo "Can't parse elements with [num3] class name."
	End If
	
	.Quit
End With

WScript.Quit 0

Sub SendMessage()
	Const cdoSendUsingPort = 2
	Const cdoBasic         = 1
	
	Const strPartSchema    = "http://schemas.microsoft.com/cdo/configuration/"
	
	With WScript.CreateObject("CDO.Message")
		With .Configuration.Fields
			.Item(strPartSchema & "sendusing")        = cdoSendUsingPort
			.Item(strPartSchema & "smtpauthenticate") = cdoBasic
			.Item(strPartSchema & "smtpserver")       = "smtp.mail.ru"
			.Item(strPartSchema & "smtpserverport")   = 465
			.Item(strPartSchema & "smtpusessl")       = True
			.Item(strPartSchema & "sendusername")     = "login"
			.Item(strPartSchema & "sendpassword")     = "password"
			
			.Update
		End With
		
		.To            = "to@yandex.ru"
		.From          = "from@mail.ru"
		.Subject       = "Subject"
		.TextBody      = "TextBody"
		
		.Send
	End With
End Sub
Может потребоваться библиотека Collaboration Data Objects.
Это сообщение посчитали полезным следующие участники:

Отправлено: 02:59, 17-09-2017 | #17