Код скрипта PDFeIMG.au3
Код:
#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Извлечение изображений из PDF", 350, 160) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUICtrlCreateLabel("Графическая оболочка к консольной программе pdfimages.exe", 10, 3) GUICtrlCreateGroup ( "Пути", 5, 20, 340, 95) GUICtrlCreateLabel("Путь к программе pdfimages.exe", 10, 35) $PrgPath = GUICtrlCreateEdit ( "Укажите программу", 10, 50, 300, 20, $ES_READONLY+$WS_HSCROLL) $PrgButton = GUICtrlCreateButton ( "xxx", 311, 50, 30, 20) GUICtrlCreateLabel("Путь к результату", 10, 75) $ImgPath = GUICtrlCreateEdit ( "Укажите директорию для извлечения", 10, 90, 300, 20, $ES_READONLY+$WS_HSCROLL) $ImgButton = GUICtrlCreateButton ( "xxx", 311, 90, 30, 20) $okbutton = GUICtrlCreateButton("Извлечь!", 270, 117, 77, 42) GUICtrlSetOnEvent($PrgButton, "PrgButton") GUICtrlSetOnEvent($ImgButton, "ImgButton") GUICtrlSetOnEvent($okbutton, "OKButton") GUICtrlSetData ( $PrgPath, IniRead ( @WindowsDir & "\Autoit.ini", "PDFeIMG", "PrgPath", "")) GUICtrlSetData ( $ImgPath, IniRead ( @WindowsDir & "\Autoit.ini", "PDFeIMG", "ImgPath", "")) GUISwitch($mainwindow) GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func PrgButton() $var = FileOpenDialog ( "Указать путь к кодеру", "", "Исполняемый файл (pdfimages.exe)", 1) if StringLen ($var) > 0 then GUICtrlSetData ( $PrgPath, $var) EndFunc Func ImgButton() $var = FileSelectFolder ( "Указать директорию для извлечения", 0) if StringLen ($var) > 0 then GUICtrlSetData ( $ImgPath, $var) EndFunc Func OKButton() ; MsgBox(0, "GUI Event", '"' & GUICtrlRead ($PrgPath) & '" -j ' & $CmdLine[1] & ' img' & GUICtrlRead ($ImgPath)) ShellExecute('"' & GUICtrlRead ($PrgPath) & '"', ' -j ' & $CmdLine[2] & $CmdLine[3] & ' img ', GUICtrlRead ($ImgPath)) 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", "PDFeIMG", "PrgPath", GUICtrlRead ($PrgPath) ) IniWrite ( @WindowsDir & "\Autoit.ini", "PDFeIMG", "ImgPath", GUICtrlRead ($ImgPath) ) Exit ;EndIf EndFunc