Modified Script:
#include <AutoItConstants.au3>
; Compare
Global $iPID = Run("magick compare -metric RMSE 1.jpg 2.jpg NULL:", "", Default, $STDOUT_CHILD)
If $iPID = 0 Then Exit ConsoleWrite("Error running Magick! @error=" & @error & ", @extended=" & @extended & @CRLF)
; Wait until the process has closed using the PID returned by Run.
Global $iWait = ProcessWaitClose($iPID)
If $iWait = 0 Then Exit ConsoleWrite("Error returned by ProcessWaitClose! @error=" & @error & ", @extended=" & @extended & @CRLF)
; Read the Stdout stream
Global $sScreenOutput = StdoutRead($iPID)
If @error Then Exit ConsoleWrite("Error returned by StdOutRead! @error=" & @error & ", @extended=" & @extended & @CRLF)
MsgBox(0, 0, $sScreenOutput)