Advertisement
liza28

sample code

Sep 12th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.20 KB | None | 0 0
  1. @echo on & setlocal EnableDelayedExpansion
  2.  
  3. set _iMacros=C:\Program Files (x86)\iOpus\iMacros\iMacros.exe
  4. set _compare=C:\Program Files\ImageMagick-6.6.8-Q16\compare.exe
  5. set _composite=C:\Program Files\ImageMagick-6.6.8-Q16\composite.exe
  6. set file="flash_error.txt"
  7.  
  8. pushd C:\Users\Documents\iMacros\ImageMagick
  9. '"%_iMacros%" -macro "va_card_flash.iim"
  10. composite -geometry 253x216+0+400 side.png flash_home_today.png flash_home_today.png
  11. composite -gravity south footer.png flash_home_today.png flash_home_today.png
  12. compare -metric AE flash_home_orig.png flash_home_today.png flash_home_diff.png 2>flash_error.txt
  13. FOR /F "eol= tokens=* delims= usebackq" %%A in (%file%) do (
  14. if "%%A" NEQ "0" (
  15. call :SendEmail
  16. ) else (
  17. for /F %%G in ('"%_compare%" -metric AE flash_home_orig.png flash_home_today.png flash_home_diff.png 2^>^&1') do (
  18. if not "%%G"=="0" call :SendEmail2
  19. )
  20. )
  21. )
  22. popd
  23. pause
  24.  
  25.  
  26. :SendEmail [VBScript for mailing]
  27. echo.Dim iMsg >> %~n0.vbs
  28. echo.Dim iConf >> %~n0.vbs
  29. echo.Dim Flds, var >> %~n0.vbs
  30.  
  31. echo.Set iConf = CreateObject("CDO.Configuration") >> %~n0.vbs
  32. echo.iConf.Load -1 >> %~n0.vbs
  33. echo.Set Flds = iConf.Fields >> %~n0.vbs
  34. echo.With Flds >> %~n0.vbs
  35. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 >> %~n0.vbs
  36. echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxx@gmail.com" >> %~n0.vbs
  37. echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass" >> %~n0.vbs
  38. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" >> %~n0.vbs
  39. echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 >> %~n0.vbs
  40. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 'NOT 25 OR 587 >> %~n0.vbs
  41. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True >> %~n0.vbs
  42. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 >> %~n0.vbs
  43. echo. .Update >> %~n0.vbs
  44. echo.End With >> %~n0.vbs
  45. echo.Set iMsg = CreateObject("CDO.Message") >> %~n0.vbs
  46. echo.strbody = "DIFFERENT SIZE" >> %~n0.vbs
  47. echo.With iMsg >> %~n0.vbs
  48. echo. Set .Configuration = iConf >> %~n0.vbs
  49. echo. .To = "email" >> %~n0.vbs
  50. echo. .From = "gmail" >> %~n0.vbs
  51. echo. .Subject = "Dimension difference" >> %~n0.vbs
  52. echo. .TextBody = strbody >> %~n0.vbs
  53. echo. .AddAttachment "\path\to\flash_home_today.png" >> %~n0.vbs
  54. echo. .Send >> %~n0.vbs
  55. echo.End With >> %~n0.vbs
  56.  
  57. %~n0.vbs & del %~n0.vbs
  58. exit /B 0
  59.  
  60. :SendEmail2 [VBScript for mailing]
  61. echo.Dim iMsg >> %~n0.vbs
  62. echo.Dim iConf >> %~n0.vbs
  63. echo.Dim Flds, var >> %~n0.vbs
  64.  
  65. echo.Set iConf = CreateObject("CDO.Configuration") >> %~n0.vbs
  66. echo.iConf.Load -1 >> %~n0.vbs
  67. echo.Set Flds = iConf.Fields >> %~n0.vbs
  68. echo.With Flds >> %~n0.vbs
  69. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 >> %~n0.vbs
  70. echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxx@gmail.com" >> %~n0.vbs
  71. echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass" >> %~n0.vbs
  72. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" >> %~n0.vbs
  73. echo. .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 >> %~n0.vbs
  74. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 'NOT 25 OR 587 >> %~n0.vbs
  75. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True >> %~n0.vbs
  76. echo. .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 >> %~n0.vbs
  77. echo. .Update >> %~n0.vbs
  78. echo.End With >> %~n0.vbs
  79. echo.Set iMsg = CreateObject("CDO.Message") >> %~n0.vbs
  80. echo.strbody = "EMAIL 2" >> %~n0.vbs
  81. echo.With iMsg >> %~n0.vbs
  82. echo. Set .Configuration = iConf >> %~n0.vbs
  83. echo. .To = "email" >> %~n0.vbs
  84. echo. .From = "gmail.com" >> %~n0.vbs
  85. echo. .Subject = "Image element difference" >> %~n0.vbs
  86. echo. .TextBody = strbody >> %~n0.vbs
  87. 'echo. .AddAttachment "C:\path\to\flash_home_today.png" >> %~n0.vbs
  88. echo. .Send >> %~n0.vbs
  89. echo.End With >> %~n0.vbs
  90.  
  91. %~n0.vbs & del %~n0.vbs
  92. exit /B 0
  93. :: End_Of_Batch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement