I'm trying to check to see if the user has the ffmpeg path stored in the Windows Env and if they do, I want to store the ffmpeg file location in a variable to use later in the script. So far, I've gotten my script to read the Windows PATH and then store it in an Array but after that I can't figure out how to tell if the file path string stored in an Array object contains the word ffmpeg. Below is what I have so far:
Code: Select all
EnvGet, OutputVar, Path
Array := StrSplit(OutputVar, `;)
Length := Object.Length(Array)
Loop, Length
{
if (Array[Length] = [I want to check if the string stored in this object contains the word ffmpeg]
{
ffmpegPath := Array[Length]
return
}
else
{
ffmpegFound := true
return
}
}
if (ffmpegFound == true) {
; store the file path into a variable
} else {
; Write script to install ffmpeg and add the file path to Windows Environment. Once that's done, store ffmpeg install location in variable.
}
return
C:\Users\Gizmo\AppData\Roaming\ActiveState\bin;c:\ffmpeg\bin\;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\MKVToolNix;C:\youtube-dl;C:\Program Files\7-Zip\;C:\Program Files (x86)\GnuWin32\bin\;C:\Program Files\NASM;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\TortoiseSVN\bin;E:\Downloads\;C:\Program Files (x86)\dotnet\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\PuTTY\;C:\Program Files\Calibre2\;C:\Program Files\Git\cmd;C:\Users\Gizmo\adb-fastboot\platform-tools_r31.0.3-windows\platform-tools;C:\FFMPEG\bin;C:\Users\Gizmo\.dotnet\tools;C:\Users\Gizmo\AppData\Local\Microsoft\WindowsApps;C:\Program Files\7-Zip\;C:\Program Files (x86)\GnuWin32\bin;C:\Perl64\bin;C:\Program Files\NASM;C:\Users\Gizmo\.dotnet\tools;C:\Program Files (x86)\Nmap