0

我不知道如何通过 ahk 上的命令行参数让我的音频提取器脚本工作。我知道命令行参数是正确的,因为我可以通过批处理文件让它工作,但我不断收到下面的错误。我想我可能在语法上做错了什么,但我就是不知道是什么。
我真的很感激任何帮助。谢谢。

错误:以下变量名包含非法字符“channels=2,samplerate=44100}:standard{access="file",mux=dummy,dst="%A_LoopF​​ield%.mp3"}

代码:

fileselectfile, File_Name, M3
SplitPath, File_Name, name
Loop, parse, name, `n
 if a_index = 2
       {
        msgbox, %A_LoopField%
        Run, "C:\Program Files\VideoLAN\VLC\vlc.exe" "-I dummy -v %File_Name% :sout=#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:standard{access="file",mux=dummy,dst="%A_LoopField%.mp3"}"
 }

如果您对我所说的音频提取功能感到好奇,这里是原始批处理代码

@ECHO OFF
REM Loop through files (Recurse subfolders)
REM Syntax
REM      FOR /R [[drive:]path] %%parameter IN (set) DO command
REM
REM Key
REM    drive:path  : The folder tree where the files are located.
REM
REM    set         : A set of one or more files. Wildcards must be used.
REM                  If (set) is a period character (.) then FOR will
REM                  loop through every folder.
REM
REM   command     : The command(s) to carry out, including any
REM                 command-line parameters.
REM
REM    %%parameter : A replaceable parameter:
REM                  in a batch file use %%G (on the command line %G)
FOR /R %%G IN (*.mp3) DO (CALL :SUB_VLC "%%G")
FOR /R %%G IN (*.mp3.mp*) DO (CALL :SUB_RENAME "%%G")
GOTO :eof

:SUB_VLC
 SET _firstbit=%1
 SET _qt="
 CALL SET _newnm=%%_firstbit:%_qt%=%%
 SET _commanm=%_newnm:,=_COMMA_%
 REM echo %_commanm%

 ECHO Transcoding %1
 REM Here's where the actual transcoding/conversion happens. The next line
 REM fires off a command to VLC.exe with the relevant arguments:
 CALL "C:\Program Files\VideoLAN\VLC\vlc" -I dummy -v %1 :sout=#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:standard{access="file",mux=dummy,dst="%_commanm%.mp3"} vlc://quit
 REM Having no SLEEP-esque command, we have to trick DOS/Windows into pausing
 REM for a bit between encode ops - To give the host OS a chance to do what it
 REM needs to - Via clever use of the PING utility:
 REM (Thanks to http://www.computing.net/answers/programming/dos-command-for-wait-5-seconds/11192.html for the tip! :-)
 PING -n 1 -w 10000 1.1.1.1 > NUL
GOTO :eof

:SUB_RENAME
 SET _origfnm=%1
 SET _endbit=%_origfnm:*.mp3=%
 CALL SET _newfilenm=%%_origfnm:.mp3%_endbit%=.mp3%%
 SET _newfilenm=%_newfilenm:_COMMA_=,%
 COPY %1 %_newfilenm%

GOTO :eof

:eof
REM My own little addition to prevent the batch window from "vanishing" without
REM trace at the end of execution, as if a critical error had occurred.
PAUSE
4

2 回答 2

0

我找到了答案。我犯了语法错误,我只是没有知识来修复自己。新的 RUN 语句完美运行。

这是新修改的脚本

fileselectfile, File_Name, M3
SplitPath, File_Name, name, dir, ext, name_no_ext, drive

    StringReplace, File_Name, File_Name,`n, \

Loop, parse, name, `n
 {if a_index = 2
        msgbox, %A_LoopField%
        Run % "C:\Program Files\VideoLAN\VLC\vlc.exe -I dummy -v """ File_Name """ :sout=#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:standard{access=""file"",mux=dummy,dst=""" A_LoopField ".mp3""} "

}
于 2012-09-05T01:13:27.507 回答
0

你试过不带SplitPath, File_Name, name吗?我摆脱了这样的错误,但我不知道它最终是否会产生你想要的结果。

于 2012-09-04T11:17:39.180 回答