Search the Community
Showing results for tags 'ShellExecuteWait'.
-
This is driving me bananas. I'm trying to normalize audio in a bunch of mp4 files. Yes, I've seen the Python program ffmpeg-normalize and failed to get it to work, and MP4Gain costs money. #include <FileConstants.au3> #include <File.au3> Global $FileList[2] $FileList[0]=1 $FileList[1]="Test.mp4" $Folder="D:\Temporary" $PathName="C:\Program Files\FFMpeg\ffmpeg.exe" If FileExists($Folder & "\Log.txt") Then FileDelete($Folder & "\Log.txt") Endif For $i = 1 To $FileList[0] $Switches = '-i "' & $Folder & "\" & $FileList[$i] & '" -af "volumedetect" -vn -sn -dn -f null null >>"' & $Folder & '\Log.txt" 2>&1' $LogHandle = FileOpen($Folder & "\Log.txt", $FO_APPEND) FileWrite($LogHandle, "============ Processing " & $FileList[$i] & "============" & @CRLF) FileWrite($LogHandle, 'FFMPeg command line "' & $PathName & '" ' & $Switches & @CRLF) FileClose($LogHandle) $Switches = '-i "' & $Folder & "\" & $FileList[$i] & '" -af "volumedetect" -vn -sn -dn -f null null >>"' & $Folder & '\Log.txt" 2>&1' $ReturnValue = ShellExecuteWait('"' & $PathName & '"',$Switches,$Folder,$SHEX_OPEN,@SW_HIDE) If $ReturnValue <> 0 Then MsgBox($MB_ICONERROR, "Error", "FFMpeg error, return code " & $ReturnValue & @CRLF & "See " & $Folder & '\Log.txt') EndIf Next which produces: and Log.txt: ============ Processing Test.mp4============ FFMPeg command line "C:\Program Files\FFMpeg\ffmpeg.exe" -i "D:\Temporary\Test.mp4" -af "volumedetect" -vn -sn -dn -f null null >>"D:\Temporary\Log.txt" 2>&1 However, if I paste "C:\Program Files\FFMpeg\ffmpeg.exe" -i "D:\Temporary\Test.mp4" -af "volumedetect" -vn -sn -dn -f null null >>"D:\Temporary\Log.txt" 2>&1 into cmd.exe, Log.txt contains: ffmpeg version N-115551-g4037d5e103-20240603 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 13.2.0 (crosstool-NG 1.26.0.65_ecc5e41) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20240603 libavutil 59. 21.100 / 59. 21.100 libavcodec 61. 6.100 / 61. 6.100 libavformat 61. 3.104 / 61. 3.104 libavdevice 61. 2.100 / 61. 2.100 libavfilter 10. 2.102 / 10. 2.102 libswscale 8. 2.100 / 8. 2.100 libswresample 5. 2.100 / 5. 2.100 libpostproc 58. 2.100 / 58. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Temporary\Test.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 title : Test artist : VideoProc Converter encoder : Lavf57.73.100 comment : Test genre : DVD Duration: 00:51:44.80, start: 0.000000, bitrate: 1737 kb/s Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 960x720 [SAR 1:1 DAR 4:3], 1600 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler vendor_id : [0][0][0][0] [Parsed_volumedetect_0 @ 000001965943e880] n_samples: 0 Stream mapping: Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native)) Press [q] to stop, [?] for help Output #0, null, to 'null': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 title : Test artist : VideoProc Converter genre : DVD comment : Test encoder : Lavf61.3.104 Stream #0:0(eng): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default) Metadata: handler_name : SoundHandler vendor_id : [0][0][0][0] encoder : Lavc61.6.100 pcm_s16le size=N/A time=00:19:19.48 bitrate=N/A speed=2.26e+03x size=N/A time=00:38:43.01 bitrate=N/A speed=2.26e+03x [Parsed_volumedetect_0 @ 000001965731ddc0] n_samples: 273838080 [Parsed_volumedetect_0 @ 000001965731ddc0] mean_volume: -29.0 dB [Parsed_volumedetect_0 @ 000001965731ddc0] max_volume: -8.1 dB [Parsed_volumedetect_0 @ 000001965731ddc0] histogram_8db: 39 [Parsed_volumedetect_0 @ 000001965731ddc0] histogram_9db: 476 [Parsed_volumedetect_0 @ 000001965731ddc0] histogram_10db: 2231 [Parsed_volumedetect_0 @ 000001965731ddc0] histogram_11db: 9378 [Parsed_volumedetect_0 @ 000001965731ddc0] histogram_12db: 30128 [Parsed_volumedetect_0 @ 000001965731ddc0] histogram_13db: 80105 [Parsed_volumedetect_0 @ 000001965731ddc0] histogram_14db: 191666 [out#0/null @ 00000196572b4140] video:0KiB audio:534840KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown size=N/A time=00:51:44.74 bitrate=N/A speed=2.28e+03x Why won't ShellExecuteWait do that?
-
Hello and Good Day to All! I am trying to install .NET 3.5 on Windows 10 x64bit via autoit (via ShellExecuteWait + PowerShell). If I run this line, it will runs without issues: ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\OJP83BU523.ps1' & '"') "OJP83BU523.ps1" contains: DISM /Online /Enable-Feature /FeatureName:NetFX3 /All /Source:D:\Sources\sxs /LimitAccess However, since I won't know in advance the drive letter of the "sources" folder, I created a script to generate a PowerShell Script to give a correct path for it. With the modified script below, PowerShell only blinks and nothing happens ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\' & $filename & '"') or ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & $filename & '"') I wish I know the difference with "$filename" and "\OJP83BU523.ps1" usage, as for me, it should be the same. Attached is my entire autoit script. any help is appreciated!, many thanks in advance! test.au3
- 5 replies
-
- shellexecute
- shellexecutewait
-
(and 2 more)
Tagged with:
-
Hello, what's the best practice to print for a PDF document a given number of copies to Windows' default printer, in *ONE* print job, without creating "n" separate print jobs? _Shellexecute($PDF,"","","print") will just print one copy per call. If there is a possibility to pass a "page count", I missed it. _FilePrint() basically just makes use of the line above. Additional Information: All printers are either Xerox 80xx Printing Systems or HP 2xxx Desktop Printers. SumatraPDF seems to be an approach, ... $PDF="C:\temp\Some-PDF-Sample-File.pdf" $Sumatra="z:\SumatraPDF.EXE" ; this will print 5 copies with *ONE* print job ShellExecute($Sumatra,'-print-to-default -print-settings "5x,fit" "' & $PDF & '"',"","open",@SW_HIDE) ... I'd just prefer to solve this task without the need of an extra program as SumatraPDF.EXE Any suggestions appreciated, Rudi.
- 2 replies
-
- shellexecutewait
- _fileprint
-
(and 2 more)
Tagged with:
-
Hi. Local $sPDFtk = FileGetShortName(@ScriptDir & "\pdftk.exe") Local $sInputPDF = FileGetShortName(@ScriptDir & "\Prodis_Test.pdf") Local $sSig_1 = FileGetShortName(@ScriptDir & "\Sig_1.pdf") Local $sTempPDF = FileGetShortName(@ScriptDir & "\Prodis_Test_TEMP.pdf") $iSuccess = ShellExecuteWait($sPDFtk, $sInputPDF & " stamp " & $sSig_1 & " output " & $sTempPDF, "", "", @SW_HIDE) @ScriptDir is "H:\_Conrad lokal\Downloads\AutoIt3\_COX". As you can see there is a space in the path. I know that ShellExecuteWait is working with FileGetShortName at the filename. It seems to me that I can't pass the parameters that way. But without FileGetShortName it's not working too. Ideas? Regards, Conrad
- 22 replies
-
- shellexecute
- shellexecutewait
-
(and 3 more)
Tagged with:
-
I'm having a problem executing a command line (with many parameters) from within my script using ShellExecuteWait(). As a debug step, my script outputs the generated cmd line and parameters to a temp text file. If I start a cmd window and cut and paste the cmd from this temp file, it works perfectly. If, however, I call ShellExecuteWait() within the script, the tool I'm running (mkvmerge.exe) always returns error code 2 (invalid cmd line). Note that mkvmerge requires a strangely "escaped" parameter list; e.g... "C:\Program Files\MKVToolNix\mkvmerge.exe" --output ^"L:/Path1/OutVid.mkv^" --no-subtitles --language 0:eng --default-track 0:yes --compression 0:none --language 1:eng --default-track 1:yes --compression 1:none ^"^(^" ^"L:/Path2/SrcVid.mkv^" ^"^)^" As you can see, mkvmerge mandates that backslashes in paths be replaced with forward-slashes, that quote marks be "escaped" by preceding them with "^" (as well as parentheses), etc. I'm pretty sure this weirdness is required because mkvmerge was designed for non-Windows OSes (or something like that). Is that part of the problem, do you think? Under Windows, do any of the quote marks need to be doubled (i.e, should it be ^""L:/Path1/OutVid.mkv^"")? How about the slashes in the path names (i.e., should it be ^"L://Path1//OutVid.mkv^")? Finally, am I correct to assume that I must use ShellExecuteWait() because one cannot pass command line parameters with RunWait()? If not, is there any benefit of using one over the other? Thanks a great deal for your consideration and assistance!
-
Im running a test to make sure browsers connect properly to the internet like this If ProcessExists('iexplore.exe') Then ProcessClose('iexplore.exe') If ProcessExists('chrome.exe') Then ProcessClose('chrome.exe') If ProcessExists('firefox.exe') Then ProcessClose('firefox.exe') Sleep(200) ShellExecuteWait('iexplore.exe') Sleep(200) If FileExists(@ProgramFilesDir & '\Google\Chrome\Application\chrome.exe') Then ShellExecuteWait('chrome.exe') Sleep(200) If FileExists(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe') Then ShellExecuteWait('firefox.exe') Sleep(200) If Not ProcessExists('iexplore.exe') Or Not ProcessExists('chrome.exe') Or Not ProcessExists('firefox.exe') Then Switch MsgBox($MB_YESNO + $MB_ICONWARNING + $MB_DEFBUTTON2, 'Browsers Check', 'Did All Browsers Work') Case $IDYES GUICtrlSetImage($BrowserIcon, $tick) RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Browser', 'REG_SZ', _Date_Time_SystemTimeToDateTimeStr($CuDate)) Case $IDNO GUICtrlSetImage($BrowserIcon, $cross) RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Browser', 'REG_SZ', 'NotCompleted') EndSwitch EndIf But it hangs like a git between ShellExecuteWait('iexplore.exe') Sleep(200) If FileExists(@ProgramFilesDir & '\Google\Chrome\Application\chrome.exe') Then ShellExecuteWait('chrome.exe') If i reduce it to this ShellExecuteWait('iexplore.exe') Sleep(200) ;~ If FileExists(@ProgramFilesDir & '\Google\Chrome\Application\chrome.exe') Then ShellExecuteWait('chrome.exe') Sleep(200) ;~ If FileExists(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe') Then ShellExecuteWait('firefox.exe') Its instant but then it gives an error that firefox cant be found if its not installed Any suggestions how to stop this hanging
-
Hi guys, I've been trying to create a registry key export for a while, but i'm hitting my head against a wall here. I've tried a huge amount of combinations for both: ShellExecuteWait & RunWait commands, but they never complete the task. ;This is the reg key Global $targetHistory = "HKEY_CURRENT_USER\Software\Hewlett-Packard\HP Print Settings\Ubicación predeterminada\Target History" RegeditTH($logHandler, $regBackup, $targetHistory) Func RegeditTH($logHandler, $regBackup, $targetHistory) Local $THRegBkup = $regBackup & "ExportTH.bat" Local $THRegHandler Local $removeFile _FileWriteLog($logHandler, "INFORMATION: ExportTH.bat storage directory = " & $regBackup & "." & @CRLF) ; Create a file to write registry keys to. If Not _FileCreate($THRegBkup) Then ; Error flags: ; 1 - Error opening specified file ; 2 - File could not be written to ; [OPTIONAL] Display a pop-up message for notification, error creating the file ;MsgBox($MB_SYSTEMMODAL, "Error", " Error reating reg file. Error Code:" & @error & ".") _FileWriteLog($logHandler, "WARNING: Registry export file not created." & @CRLF) Else $THRegHandler = FileOpen ($THRegBkup ,$FO_APPEND) If $THRegHandler <> -1 Then _FileWriteLog($logHandler, "INFORMATION: Performing registry backup for Target History keys." & @CRLF) FileWrite($THRegHandler, "@echo off" & @CRLF) ;FileWrite($THRegHandler, "regedit.exe /e " & $regBackup & "TargetHistory.reg " & '"HKEY_CURRENT_USER\Software\Hewlett-Packard\HP Print Settings\Ubicación predeterminada\Target History"' & @CRLF) FileWrite($THRegHandler, "Reg export " & '"HKEY_CURRENT_USER\Software\Hewlett-Packard\HP Print Settings\Ubicación predeterminada\Target History" ' & $regBackup & "TargetHistory.reg " & "/y" & @CRLF) FileWrite($THRegHandler, "dir " & $regBackup & @CRLF) FileWrite($THRegHandler, "dir " & $regBackup & " >> " & $regBackup & "dir.txt" & @CRLF) FileWrite($THRegHandler, "pause" & @CRLF) FileWrite($THRegHandler, "exit /B" & @CRLF) FileWrite($THRegHandler, "exit" & @CRLF) FileClose($THRegHandler) ;RunWait(@ComSpec & " /k " & "regedit.exe /e " & $regBackup & "TargetHistory2.reg " & $targetHistory) ;ShellExecuteWait(@ComSpec , "/k regedit.exe /e " & $regBackup & "TargetHistory.reg " & $targetHistory) ;ShellExecuteWait(@ComSpec & " /c " & $THRegBkup, @SW_HIDE) RunWait(@ComSpec & " /c " & $THRegBkup) ; Error Flag is set to non-zero in case of failure If @error <> 0 Then _FileWriteLog($logHandler, "ERROR: Registry export failed." & @CRLF) Else _FileWriteLog($logHandler, "WARNING: ExportTH.bat file could not be opened." & @CRLF) EndIf $removeFile = FileDelete($THRegBkup) If $removeFile Then _FileWriteLog($logHandler, "INFORMATION: File " & $THRegBkup & " deleted." Else _FileWriteLog($logHandler, "WARNING: File " & $THRegBkup & " not deleted or it does not exist." EndIf EndIf ; Close the handle returned by FileOpen. FileClose($THRegHandler) EndFunc This is the function i'm using for the call. Since i was not going anywhere with the AutoIt direct executions, i even tried creating a bat/cmd file with the command for a reg export to create the reg file i needed. However, even running the bat file is not working for me. I mean, the bat is executed, as you can see i created a couple of "dir" commands to be prompted and sent to a file. And they are showing up, but the registry export is never being executed. The best i could get was a message saying it was impossible to locate the key, but i know with 100% certainty the key exists in that path (because i'm creating and deleting it all the time). Can anyone point out any possible mistakes? Here you can see the error message in the CMD prompt: Thanks!
-
I was wondering if there are any developers out there who are having issues running AutoIT code on the latest revision of Win8? I recently (about 4 months ago) wrote an auto-installer that pulled tools from a server and ran an auto install of each tool on systems. This worked fine for revisions 8250, 8375 and 8400. However, when Win8 revision 8441 came around, I noticed some issues running some installers. Now with the newest revision, 8520, it seems that FileCopy, DirCopy, ShellExecute, ShellExecuteWait, Run, and RunWait are all either locking up, or just failing to run. The steps I take are: Read from a cfg file the path of the installer, and any installer arguments download installer from path use ShellExecuteWait on installer with arguments In the past, I've had no problems with this same exact code. UAC is off, #RequireAdmin is set, application is run as administrator, and even powershell is set to "Set-ExecutionPolicy UnRestricted" Has anybody else had this problem? Anybody have workarounds?