Код скрипта DJVU.au3

Код:
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode 
$mainwindow = GUICreate("Конвертор TIF в DJVU", 350, 160)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("Графическая оболочка к программе documenttodjvu.exe", 10, 3)

GUICtrlCreateGroup ( "Пути", 5, 20, 340, 95)

$okbutton = GUICtrlCreateButton("Кодировать!", 270, 117, 77, 42)

GUICtrlCreateLabel("Путь к кодировщику", 10, 35)
$EncPath = GUICtrlCreateEdit ( "Укажите кодер",  10, 50, 300, 20, $ES_READONLY+$WS_HSCROLL)
$EncButton = GUICtrlCreateButton ( "xxx", 311, 50, 30, 20)

GUICtrlCreateLabel("Путь к результату", 10, 75)
$DjvuPath = GUICtrlCreateEdit ( "Укажите файл",  10, 90, 300, 20, $WS_HSCROLL)
$DjvuButton = GUICtrlCreateButton ( "xxx", 311, 90, 30, 20)


GUICtrlSetOnEvent($EncButton, "EncButton")
GUICtrlSetOnEvent($DjvuButton, "DjvuButton")
GUICtrlSetOnEvent($okbutton, "OKButton")

	GUICtrlSetData ( $EncPath, IniRead ( @WindowsDir & "\Autoit.ini", "DJVU", "EncPath", ""))
	GUICtrlSetData ( $DjvuPath, IniRead ( @WindowsDir & "\Autoit.ini", "DJVU", "DjvuPath", ""))

GUISwitch($mainwindow)
GUISetState(@SW_SHOW)

While 1
  Sleep(1000)  ; Idle around
WEnd

Func EncButton()
	$var = FileOpenDialog ( "Указать путь к кодеру", "", "Исполняемый файл (documenttodjvu.exe)", 1)
	if StringLen ($var) > 0 then GUICtrlSetData ( $EncPath, $var)
EndFunc

Func DjvuButton()
	$var = FileSaveDialog ( "Указать конечный файл", "", "DJVU (*.djvu)", 1)
	if StringLen ($var) > 0 then GUICtrlSetData ( $DjvuPath, $var & '.djvu')
EndFunc


Func OKButton()
	Run('"' & GUICtrlRead ($EncPath) & '"' & ' --verbose --aggressive --filelist=' & $CmdLine[1] & ' ' & GUICtrlRead ($DjvuPath), "")
	CLOSEClicked ()
EndFunc

Func CLOSEClicked()
  ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
  ;@GUI_WINHANDLE will be either $mainwindow or $dummywindow
  ;If @GUI_WINHANDLE = $mainwindow Then 
  ;  MsgBox(0, "GUI Event", "You clicked CLOSE in the main window! Exiting...")
	IniWrite ( @WindowsDir & "\Autoit.ini", "DJVU", "EncPath", GUICtrlRead ($EncPath) )
	IniWrite ( @WindowsDir & "\Autoit.ini", "DJVU", "DjvuPath", GUICtrlRead ($DjvuPath) )
    Exit
  ;EndIf 
EndFunc