Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo on & setlocal EnableDelayedExpansion
- set _iMacros=C:\Program Files (x86)\iOpus\iMacros\iMacros.exe
- set _compare=C:\Program Files\ImageMagick-6.6.8-Q16\compare.exe
- set _composite=C:\Program Files\ImageMagick-6.6.8-Q16\composite.exe
- set file="flash_error.txt"
- pushd C:\Users\Documents\iMacros\ImageMagick
- '"%_iMacros%" -macro "va_card_flash.iim"
- composite -geometry 253x216+0+400 side.png flash_home_today.png flash_home_today.png
- composite -gravity south footer.png flash_home_today.png flash_home_today.png
- compare -metric AE flash_home_orig.png flash_home_today.png flash_home_diff.png 2>flash_error.txt
- FOR /F "eol= tokens=* delims= usebackq" %%A in (%file%) do (
- if "%%A" NEQ "0" (
- call :SendEmail
- ) else (
- for /F %%G in ('"%_compare%" -metric AE flash_home_orig.png flash_home_today.png flash_home_diff.png 2^>^&1') do (
- if not "%%G"=="0" call :SendEmail2
- )
- )
- )
- popd
- pause
- :SendEmail [VBScript for mailing]
- echo.Dim iMsg >> %~n0.vbs
- echo.Dim iConf >> %~n0.vbs
- echo.Dim Flds, var >> %~n0.vbs
- echo.Set iConf = CreateObject("CDO.Configuration") >> %~n0.vbs
- echo.iConf.Load -1 >> %~n0.vbs
- echo.Set Flds = iConf.Fields >> %~n0.vbs
- echo.With Flds >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxx@gmail.com" >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass" >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 'NOT 25 OR 587 >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 >> %~n0.vbs
- echo. .Update >> %~n0.vbs
- echo.End With >> %~n0.vbs
- echo.Set iMsg = CreateObject("CDO.Message") >> %~n0.vbs
- echo.strbody = "DIFFERENT SIZE" >> %~n0.vbs
- echo.With iMsg >> %~n0.vbs
- echo. Set .Configuration = iConf >> %~n0.vbs
- echo. .To = "email" >> %~n0.vbs
- echo. .From = "gmail" >> %~n0.vbs
- echo. .Subject = "Dimension difference" >> %~n0.vbs
- echo. .TextBody = strbody >> %~n0.vbs
- echo. .AddAttachment "\path\to\flash_home_today.png" >> %~n0.vbs
- echo. .Send >> %~n0.vbs
- echo.End With >> %~n0.vbs
- %~n0.vbs & del %~n0.vbs
- exit /B 0
- :SendEmail2 [VBScript for mailing]
- echo.Dim iMsg >> %~n0.vbs
- echo.Dim iConf >> %~n0.vbs
- echo.Dim Flds, var >> %~n0.vbs
- echo.Set iConf = CreateObject("CDO.Configuration") >> %~n0.vbs
- echo.iConf.Load -1 >> %~n0.vbs
- echo.Set Flds = iConf.Fields >> %~n0.vbs
- echo.With Flds >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxx@gmail.com" >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass" >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 'NOT 25 OR 587 >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True >> %~n0.vbs
- echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 >> %~n0.vbs
- echo. .Update >> %~n0.vbs
- echo.End With >> %~n0.vbs
- echo.Set iMsg = CreateObject("CDO.Message") >> %~n0.vbs
- echo.strbody = "EMAIL 2" >> %~n0.vbs
- echo.With iMsg >> %~n0.vbs
- echo. Set .Configuration = iConf >> %~n0.vbs
- echo. .To = "email" >> %~n0.vbs
- echo. .From = "gmail.com" >> %~n0.vbs
- echo. .Subject = "Image element difference" >> %~n0.vbs
- echo. .TextBody = strbody >> %~n0.vbs
- 'echo. .AddAttachment "C:\path\to\flash_home_today.png" >> %~n0.vbs
- echo. .Send >> %~n0.vbs
- echo.End With >> %~n0.vbs
- %~n0.vbs & del %~n0.vbs
- exit /B 0
- :: End_Of_Batch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement