fraizor Posted July 14, 2022 Posted July 14, 2022 (edited) Hello i am trying to run image magick then get the result of the compare process #include <AutoItConstants.au3> #include <Array.au3> ; Compare $iPID = Run("magick compare -metric RMSE 1.jpg 2.jpg NULL:","", @SW_SHOW, $STDOUT_CHILD) ; Wait until the process has closed using the PID returned by Run. ProcessWaitClose($iPID) ; Read the Stdout stream $ScreenOutput = StdoutRead($iPID) MsgBox(0,0,$ScreenOutput) i have 2 questions: 1- why the console (logs) is always writing the result even that i didn't used console write function 2- why msg box is empty ? Edited July 14, 2022 by fraizor AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !
water Posted July 14, 2022 Posted July 14, 2022 Please provide more information: Post the output you get when you run "magick" in a DOS window @SW_SHOW isn't a valid flag for the Run statement Check for error after each function. Run sets @error Check the length of $ScreenOutput using StringLen to make sure the string is empty fraizor 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
fraizor Posted July 14, 2022 Author Posted July 14, 2022 Hello thank you for fast response 1- 2- Okay what i should use ? i don't really care if it is showed or hidden 3- sorry i don't know how to do that .. can you please edit my example to teach me how ? 4- string len returns 0 AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !
fraizor Posted July 14, 2022 Author Posted July 14, 2022 52 minutes ago, water said: Please provide more information: Post the output you get when you run "magick" in a DOS window @SW_SHOW isn't a valid flag for the Run statement Check for error after each function. Run sets @error Check the length of $ScreenOutput using StringLen to make sure the string is empty Actually the strange thing that it is working but in an unexpected way ! it is showing the correct output in the console , but not showing in msgbox ! AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !
water Posted July 14, 2022 Posted July 14, 2022 (edited) 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) Edited July 14, 2022 by water fraizor 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
fraizor Posted July 14, 2022 Author Posted July 14, 2022 4 minutes ago, water said: 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) Thank you @water actually now i get the issue for some reason the imagemagick is returning the result in form of error ! even in CMD i tried to write the output to a file but it have me empty file , when i write the error to a file it will show the result there in output.err AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !
water Posted July 14, 2022 Posted July 14, 2022 Replace $STDOUT_CHILD with $STDERR_MERGED to get both streams when you read Stdout. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
fraizor Posted July 14, 2022 Author Posted July 14, 2022 3 minutes ago, water said: Replace $STDOUT_CHILD with $STDERR_MERGED to get both streams when you read Stdout. I love you @water thank you very much , $STDERR_MERGED did solve the issue AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !
water Posted July 14, 2022 Posted July 14, 2022 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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