tmplinshi wrote: ↑11 Dec 2019, 01:11
The pipe symbol is the syntax of the batch language, you need to run the command in cmd.exe.
Code: Select all
Runwait, cmd /c "%FFMPeg%" %gif_param%
Thank you for your help. That makes sense as I think about it. However, I still can't get the code to work with the Runwait. However, with some digging and messing around I did get it to work the following way:
Code: Select all
#SingleInstance,Force
FFMpeg:="C:\Program Files (x86)\FFmpeg\bin\ffmpeg.exe"
Magick:="C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe"
New_File_Name:="TESTING"
gif_param = -ss 2 -t 3 -i "%A_ScriptDir%\%New_File_Name%.mp4" -vf fps=30 -c:v pam -f image2pipe pipe:1 | "%Magick%" convert -delay 3.33 - -loop 0 -layers optimize "%A_ScriptDir%\%New_File_Name%.gif"
Video_to_Gif:= """" FFMPEG """ " gif_param
RunWaitTwo("""" Video_to_Gif """ ")
;~ Runwait, cmd /c %Video_to_Gif%
RunWaitTwo(command) {
; WshShell object: http msdn.microsoft.com /en-us/library/aew9yb99 Broken Link for safety
shell := ComObjCreate("WScript.Shell")
launch := "cmd.exe /c " . command
exec := shell.Run(launch, 0, true)
; Read and return the command's output
Return
}
ExitApp
Return
It took some messing around for sure with this Runwait function for creating a shell object I found online. In the end to get this work I had to put quotations around my whole "command" for it to actually work. When I related that idea to your Runwait line you provided, it worked perfectly.
Here is the final short script using your Runwait Line.
Code: Select all
#SingleInstance,Force
FFMpeg:="C:\Program Files (x86)\FFmpeg\bin\ffmpeg.exe"
Magick:="C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe"
New_File_Name:="TESTING"
gif_param = -ss 2 -t 3 -i "%A_ScriptDir%\%New_File_Name%.mp4" -vf fps=30 -c:v pam -f image2pipe pipe:1 | "%Magick%" convert -delay 3.33 - -loop 0 -layers optimize "%A_ScriptDir%\%New_File_Name%.gif"
Video_to_Gif:= """" FFMPEG """ " gif_param
Runwait, cmd /c "%Video_to_Gif%"
ExitApp
Return
Thank you very much,
DMDComposer