VB Interface and Capturing STDERR
Posted: 2010-04-15T09:10:22-07:00
The compare command outputs the location info to STDERR. So the command line below works perfectly. The location info goes into loc.txt (2> sends STDERR to loc.txt). I have coded this up to use the windows shell command and it runs perfectly.
compare -metric rmse -dissimilarity-threshold 1 c:\temp\main.bmp c:\temp\sub.bmp c:\result.bmp 2>c:\temp\loc.txt
I want to test using the windows shell approach to using the VB interface. I am using VBA in Excel. The code below works but I have no clue how to get STDERR. Everything I have tried has not worked. Any ideas?
Sub TestCompare()
Dim imgObj As Object
Dim loc As Variant
Dim mainImage As String
Dim subImage As String
Dim resultImage As String
mainImage = "C:\temp\main.bmp"
subImage = "C:\temp\sub.bmp"
resultImage = "C:\temp\result.bmp"
Set imgObj = CreateObject("ImageMagickObject.MagickImage.1")
loc = imgObj.Compare("-metric", "rmse", "-dissimilarity-threshold", "1", mainImage, subImage, resultImage)
Set imgObj = Nothing
End Sub
compare -metric rmse -dissimilarity-threshold 1 c:\temp\main.bmp c:\temp\sub.bmp c:\result.bmp 2>c:\temp\loc.txt
I want to test using the windows shell approach to using the VB interface. I am using VBA in Excel. The code below works but I have no clue how to get STDERR. Everything I have tried has not worked. Any ideas?
Sub TestCompare()
Dim imgObj As Object
Dim loc As Variant
Dim mainImage As String
Dim subImage As String
Dim resultImage As String
mainImage = "C:\temp\main.bmp"
subImage = "C:\temp\sub.bmp"
resultImage = "C:\temp\result.bmp"
Set imgObj = CreateObject("ImageMagickObject.MagickImage.1")
loc = imgObj.Compare("-metric", "rmse", "-dissimilarity-threshold", "1", mainImage, subImage, resultImage)
Set imgObj = Nothing
End Sub