Код скрипта Lame.au3
Код:
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$mainwindow = GUICreate("Конвертор WAV в MP3", 350, 170)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("Графическая оболочка к консольной программе Lame.exe", 10, 3)
GUICtrlCreateGroup ( "Пути", 5, 20, 340, 95)
GUICtrlCreateLabel("Путь к кодировщику", 10, 35)
$EncPath = GUICtrlCreateEdit ( "Укажите кодер", 10, 50, 300, 20, $ES_READONLY+$WS_HSCROLL)
$EncButton = GUICtrlCreateButton ( "xxx", 311, 50, 30, 20)
GUICtrlCreateLabel("Путь к результату", 10, 75)
$Mp3Path = GUICtrlCreateEdit ( "Укажите директорию", 10, 90, 300, 20, $ES_READONLY+$WS_HSCROLL)
$Mp3Button = GUICtrlCreateButton ( "xxx", 311, 90, 30, 20)
GUICtrlCreateGroup ( "AVR", 5, 110, 110, 60)
GUICtrlCreateLabel("Битрейт", 10, 125)
$BitRate = GUICtrlCreateCombo ("", 10, 140)
$okbutton1 = GUICtrlCreateButton("Go!", 60, 120, 50, 45, $BS_MULTILINE )
GUICtrlCreateGroup ( "VBR", 115, 110, 130, 60)
GUICtrlCreateLabel("Кач-во,0-Мax", 120, 125)
GUICtrlCreateLabel("9-Мin", 156, 140)
$Quality = GUICtrlCreateEdit ("", 120, 140, 30, 20, $WS_HSCROLL)
$okbutton2 = GUICtrlCreateButton("Go!", 190, 120, 50, 45, $BS_MULTILINE)
$okbutton3 = GUICtrlCreateButton("Decode in WAV", 250, 120, 95, 45, $BS_MULTILINE+$BS_CENTER )
GUICtrlSetOnEvent($EncButton, "EncButton")
GUICtrlSetOnEvent($Mp3Button, "Mp3Button")
GUICtrlSetOnEvent($okbutton1, "OKButton1")
GUICtrlSetOnEvent($okbutton2, "OKButton2")
GUICtrlSetOnEvent($okbutton3, "OKButton3")
GUICtrlSetData ( $EncPath, IniRead ( @WindowsDir & "\Autoit.ini", "Lame", "EncPath", ""))
GUICtrlSetData ( $MP3Path, IniRead ( @WindowsDir & "\Autoit.ini", "Lame", "Mp3Path", ""))
GUICtrlSetData ( $BitRate, "8|16|24|32|40|48|56|64|80|96|112|128|160|192|224|256|320", IniRead ( @WindowsDir & "\Autoit.ini", "Lame", "BitRate", "128"))
GUICtrlSetData ( $Quality, IniRead ( @WindowsDir & "\Autoit.ini", "Lame", "Quality", ""))
GUISwitch($mainwindow)
GUISetState(@SW_SHOW)
While 1
Sleep(1000) ; Idle around
WEnd
Func EncButton()
$var = FileOpenDialog ( "Указать пусть к кодеру", "", "Исполняемый файл (Lame.exe)", 1)
if StringLen ($var) > 0 then GUICtrlSetData ( $EncPath, $var)
EndFunc
Func Mp3Button()
$var = FileSelectFolder ( "Директория для результата", "", 0)
if StringLen ($var) > 0 then GUICtrlSetData ( $Mp3Path, $var)
EndFunc
Func OKButton1()
Run('"' & GUICtrlRead ($EncPath) & '"' & ' --abr ' & GUICtrlRead ($BitRate) & ' "' & $CmdLine[2] & $CmdLine[3] & '"' & " " & '"' & GUICtrlRead ($MP3Path) & "\" & $CmdLine[3] & '.mp3"', "")
CLOSEClicked ()
EndFunc
Func OKButton2()
MsgBox(0, "GUI Event", '"' & GUICtrlRead ($EncPath) & '"' & ' -V ' & GUICtrlRead ($Quality) & ' "' & $CmdLine[2] & $CmdLine[3] & '"' & " " & '"' & GUICtrlRead ($MP3Path) & "\" & $CmdLine[3] & '.mp3"')
ClipPut ( '"' & GUICtrlRead ($EncPath) & '"' & ' -V ' & GUICtrlRead ($Quality) & ' "' & $CmdLine[2] & $CmdLine[3] & '"' & " " & '"' & GUICtrlRead ($MP3Path) & "\" & $CmdLine[3] & '.mp3"')
Run('"' & GUICtrlRead ($EncPath) & '"' & ' -V ' & GUICtrlRead ($Quality) & ' "' & $CmdLine[2] & $CmdLine[3] & '"' & " " & '"' & GUICtrlRead ($MP3Path) & "\" & $CmdLine[3] & '.mp3"', "")
CLOSEClicked ()
EndFunc
Func OKButton3()
Run('"' & GUICtrlRead ($EncPath) & '"' & ' --decode "' & $CmdLine[2] & $CmdLine[3] & '"' & " " & '"' & GUICtrlRead ($MP3Path) & "\" & $CmdLine[3] & '.wav"', "")
CLOSEClicked ()
EndFunc
Func CLOSEClicked()
IniWrite ( @WindowsDir & "\Autoit.ini", "Lame", "EncPath", GUICtrlRead ($EncPath) )
IniWrite ( @WindowsDir & "\Autoit.ini", "Lame", "Mp3Path", GUICtrlRead ($Mp3Path) )
IniWrite ( @WindowsDir & "\Autoit.ini", "Lame", "BitRate", GUICtrlRead ($BitRate) )
IniWrite ( @WindowsDir & "\Autoit.ini", "Lame", "Quality", GUICtrlRead ($Quality) )
Exit
EndFunc