memerim Posted January 18, 2020 Author Share Posted January 18, 2020 Supposed to send the commands inside the command line window? Link to comment Share on other sites More sharing options...
Subz Posted January 18, 2020 Share Posted January 18, 2020 No, just copy and paste the command into the command prompt. Link to comment Share on other sites More sharing options...
memerim Posted January 18, 2020 Author Share Posted January 18, 2020 Link to comment Share on other sites More sharing options...
Subz Posted January 18, 2020 Share Posted January 18, 2020 Downloaded and installed ImageMagick, I didn't get any results using your previous script, because the output was in the Error stream not Output stream, I also didn't require cmd so unsure if the following works for you as well (I don't use ImageMagick): #include <AutoItConstants.au3> Local $hTimer = TimerInit() Local $sCompare = '"C:\Program Files\ImageMagick-7.0.9-Q16\magick.exe" compare' Local $sCommand, $sResult = "", $iPID For $i = 1 to 5 $sResult = "" $sCommand = '"C:\Users\CAIO\Downloads\' & $i & '.bmp" "C:\Users\CAIO\Downloads\y.bmp" -metric RMSE -subimage-search' $iPID = Run($sCompare & " " & $sCommand, "", @SW_HIDE, $STDERR_CHILD) ProcessWaitClose($iPID) $sResult = StderrRead($iPID) $sResult = StringStripWS($sResult, 3) $sResult = StringLeft($sResult, StringInStr($sResult, " (", 0, 1) - 1) ConsoleWrite("Result(" & $i & "): = " & $sResult & @CRLF) Next Local $fTimerDiff = TimerDiff($hTimer) MsgBox(4096, "Timer", "Time = " & Round($fTimerDiff/1000, 2)) Link to comment Share on other sites More sharing options...
memerim Posted January 18, 2020 Author Share Posted January 18, 2020 (edited) Thank you for the help Subz, you're always helping me out, thank you!!! 😸 Took 1.7 sec running your script to compare 5 img, its too much to me. I think doing this way: #RequireAdmin $t1 = TimerInit() $iC = @ScriptDir & "\compare" $X = 0 While 1 $X = $X + 1 $Commandline2 = "C:\Users\CAIO\Downloads\'&$X&'.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>diff.txt" RunWait(@ComSpec & " /C " & $iC & " " & $Commandline2, "", @SW_HIDE) $F = FileRead("C:\Users\CAIO\Downloads\ImageMagick\diff.txt") ConsoleWrite($X&" "&$F&@CRLF) If $X = 5 Then ExitLoop WEnd $t2 = TimerDiff($t1) ConsoleWrite("Time = "&$t2&@CRLF) ; Output: 1 1955.72 (0.0298424) 2 1955.72 (0.0298424) 3 1955.72 (0.0298424) 4 1955.72 (0.0298424) 5 1955.72 (0.0298424) Time = 545.9409 P.S: Any help increasing speed, are welcome! -EDIT- #RequireAdmin $t1 = TimerInit() $iC = "C:\Users\CAIO\Downloads\ImageMagick\compare.exe" $Commandline1 = "C:\Users\CAIO\Downloads\1.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>1.txt" $Commandline2 = "compare C:\Users\CAIO\Downloads\2.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>2.txt" $Commandline3 = "compare C:\Users\CAIO\Downloads\3.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>3.txt" $Commandline4 = "compare C:\Users\CAIO\Downloads\4.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>4.txt" $Commandline5 = "compare C:\Users\CAIO\Downloads\5.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>5.txt" RunWait(@ComSpec & " /C " & $iC & " " & $Commandline1 & " & " & $Commandline2 & " & " & $Commandline3 & " & " & $Commandline4 & " & " & $Commandline5, "", @SW_HIDE) $Y = 0 While 1 $Y = $Y + 1 $F = FileRead("C:\Users\CAIO\Downloads\ImageMagick\"&$Y&".txt") ConsoleWrite($Y&" "&$F&@CRLF) If $Y = 5 Then ExitLoop WEnd $t2 = TimerDiff($t1) ConsoleWrite("Time = "&$t2&@CRLF) ; I decreased the time to 190ms! I put all the commands inside variables $Commandline1 saving output to different files, then read it values. Edited January 18, 2020 by memerim Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now