global
$my_version =
"1.0.0.0"global const
$MF_BYPOSITION = 0x00000400
global const
$MF_SEPARATOR = 0x00000800
global const
$MF_CHECKED = 0x00000008
global const
$MF_POPUP = 0x00000010
global const
$BS_ICON = 0x0040
global const
$BS_AUTOCHECKBOX = 0x0003
global const
$BS_PUSHLIKE = 0x1000
AutoItSetOption(
"GUIOnEventMode", 1)
AutoItSetOption(
"TrayMenuMode", 9)
AutoItSetOption(
"TrayOnEventMode", 1)
AutoItSetOption(
"GUICoordMode", 1)
global
$my_name =
"ffe" global
$my_title =
" ffe.. ffmpeg front-end"global
$ini_path =
$my_name &
".ini"ce_Singleton(
$my_name, 1)
if @error = 183 then
WinActivate(
$my_title)
exit 5
endif
if @Compiled then
$me_app = @ScriptFullPath
else
$me_app = @ScriptDir &
"\" &
$my_name &
".exe"endif
global
$infile,
$outfile,
$out_args,
$v_codec,
$a_codec,
$resize_preset,
$args,
$msgsglobal
$installed_ini,
$matof_string,
$old_matof,
$no_video,
$no_audio,
$launch_presetglobal
$ffmpeg = 0,
$find_count = 0,
$switches,
$go,
$log_file,
$log_stringglobal
$arTransItems[10]
global
$data_parent = @AppDataDir &
"\corz\" &
$my_nameif not FileExists(
$data_parent) then DirCreate(
$data_parent)
global
$my_url =
"http://corz.org/windows/software/" &
$my_name &
"/"global
$folder_icon_index = -5
global
$min_width = 556
global
$min_height = 480
$height_magic = 24
if
$CmdLine[0] then
if StringRight(StringStripWS(
$CmdLineRaw, 3), 1) <>
")" then
$infile = StringStripWS(
$CmdLine[
$CmdLine[0]], 3)
for
$i = 1 to
$CmdLine[0]
if
$CmdLine[
$i] <>
$infile then
$switches &=
" " &
$CmdLine[
$i]
next
else
$infile =
"" for
$i = 1 to
$CmdLine[0]
$switches &=
" " &
$CmdLine[
$i]
next
endif
endif
if
$switches then
$switches = StringStripWS(
$switches, 3)
if StringLeft(
$switches, 2) =
"go" then
$launch_preset = StringTrimRight(StringMid(
$switches, 4, -1), 1)
$go = true
elseif StringLeft(
$switches, 4) =
"load" then
$go = false
$launch_preset = StringTrimRight(StringMid(
$switches, 6, -1), 1)
endif
endif
if
$infile =
"portable" then
$installed_ini = FileInstall(
".\stuff\ffe.ini", @ScriptDir &
"\" &
$ini_path)
$infile =
""endif
if FileExists(
$ini_path) then
$portable = true
$ini_path = @ScriptDir &
"\" &
$ini_pathelse
if not FileExists(
$data_parent) then DirCreate(
$data_parent)
$ini_path =
$data_parent &
"\" &
$ini_path $installed_ini = FileInstall(
".\stuff\ffe.ini",
$ini_path)
endif
if not
$installed_ini then UpdateIniFile()
global
$x = IniRead(
$ini_path,
$my_name,
"x", -1)
global
$y = IniRead(
$ini_path,
$my_name,
"y", -1)
global
$width = IniRead(
$ini_path,
$my_name,
"width", 567)
global
$height = IniRead(
$ini_path,
$my_name,
"height", 580)
global
$ini_v_codecs = IniRead(
$ini_path,
$my_name,
"video_codecs",
"||copy|mpeg1video|mpeg2video|mpeg4|msmpeg4v2|libxvid|wmv1|wmv2|flv|flic|h261|h263|libx264|mjpeg|rawvideo|disable video")
global
$ini_a_codecs = IniRead(
$ini_path,
$my_name,
"audio_codecs",
"||copy|ac3|libfaac|adpcm_ima_wav|flac|mp2|libmp3lame|libvorbis|pcm_alaw|pcm_mulaw|libgsm|disable audio")
global
$filetypes = IniRead(
$ini_path,
$my_name,
"file_types",
"All(*.*)|Audio Files(*.mp3)global
$v_bitrates = IniRead(
$ini_path,
$my_name,
"video_bitrates",
"||360k|512k|640k|768k|1000k|1200k|1600k|1800k|2000k")
global
$a_bitrates = IniRead(
$ini_path,
$my_name,
"audio_bitrates",
"||32k|48k|56k|64k|80k|96k|112k|128k|160k|192k|256k|320k")
global
$v_fps = IniRead(
$ini_path,
$my_name,
"frames_per_second",
"||12|15|20|23.976|24|25|29.97|30")
global
$target_types = IniRead(
$ini_path,
$my_name,
"target_types",
"||pal-vcd|dvd|ntsc-svcd|vcd|svcd|dv|dv50")
global
$ini_preset_resizes = IniRead(
$ini_path,
$my_name,
"preset_resizes",
"||sqcif|qcif|cif|4cif|qqvga|qvga|vga|svga|xga|uxga|qxga|sxga|qsxga|hsxga|wvga|wxga|wsxga|wuxga|woxga|wqsxga|wquxga|whsxga|whuxga|cga|ega|hd480|hd720|hd1080")
global
$on_top = IniReadCheckBoxValue(
$ini_path,
$my_name,
"on_top",
$GUI_UNCHECKED)
global
$user_trans = IniRead(
$ini_path,
$my_name,
"transparency", 0)
global
$do_console_readout = IniReadCheckBoxValue(
$ini_path,
$my_name,
"console_output",
$GUI_CHECKED)
global
$log_append = IniReadCheckBoxValue(
$ini_path,
$my_name,
"log_append",
$GUI_UNCHECKED)
global
$resize_order = IniReadCheckBoxValue(
$ini_path,
$my_name,
"resize_order",
$GUI_UNCHECKED)
global
$replace_mode = IniReadCheckBoxValue(
$ini_path,
$my_name,
"replace_mode",
$GUI_CHECKED)
global
$store_filepaths = IniReadCheckBoxValue(
$ini_path,
$my_name,
"store_filepaths",
$GUI_UNCHECKED)
global
$matof_status = IniReadCheckBoxValue(
$ini_path,
$my_name,
"matof_status",
$GUI_CHECKED)
global
$image_buttons = IniRead(
$ini_path,
$my_name,
"image_buttons",
"false")
global
$magic_butt = IniRead(
$ini_path,
$my_name,
"magic_butt", -6)
global
$matof_separator = IniRead(
$ini_path,
$my_name,
"matof_separator",
" ")
if
$matof_separator =
"" then
$matof_separator =
" "global
$overwrite = IniReadCheckBoxValue(
$ini_path,
$my_name,
"overwrite",
$GUI_CHECKED)
$i = IniRead(
$ini_path,
$my_name,
"log_file",
"")
if
$i =
"-" then
$log_file = @TempDir &
"\ffe_tmp.log"elseif
$i and TestFileWrite(
$i) then
$log_file =
$ielse
$log_file = @ScriptDir &
"\" &
$my_name &
".log"endif
global
$ffmpeg_loc = @ScriptDir &
"\ffmpeg.exe"$i = IniRead(
$ini_path,
$my_name,
"ffmpeg_binary",
$ffmpeg_loc)
if FileExists(
$i) then
$ffmpeg_loc =
$iif not FileExists(
$ffmpeg_loc) then
$ffmpeg_loc = FileOpenDialog(
"Please locate the ffmpeg binary..", @ScriptDir,
"ffmpeg binary (ffmpeg.exe)", 1)
if
$ffmpeg_loc and FileExists(
$ffmpeg_loc) then
IniWrite(
$ini_path,
$my_name,
"ffmpeg_binary",
$ffmpeg_loc)
else
$ffmpeg_loc =
"" endif
endif
$half_width =
$width/2
$column_two =
$width/3
TrayCreateItem(
"About " &
$my_name)
TrayItemSetOnEvent(-1,
"DoAboutBox")
TrayCreateItem(
"")
TrayCreateItem(
"Exit (Alt+F4 or Esc)")
TrayItemSetOnEvent(-1,
"User_DoQuit")
TraySetOnEvent(
$TRAY_EVENT_PRIMARYDOWN,
"ToggleWindow")
TraySetClick(8)
TraySetState()
TraySetToolTip (
"left-click to toggle the main window" & @LF &
"right-click to bring up the tray menu")
$ffeGUI = GUICreate(
$my_title,
$width,
$height,
$x,
$y, _
BitOr(
$WS_SIZEBOX,
$WS_MINIMIZEBOX,
$WS_MAXIMIZEBOX,
$WS_CAPTION,
$WS_POPUP),
$WS_EX_ACCEPTFILES)
GUISetOnEvent(
$GUI_EVENT_CLOSE,
"User_DoQuit")
GUISetOnEvent(
$GUI_EVENT_RESIZED,
"ResizeCheckSize")
GUISetOnEvent(
$GUI_EVENT_MINIMIZE,
"ToggleWindow")
GUISetOnEvent(
$GUI_EVENT_PRIMARYUP,
"PrimaryUpCheckSize")
GUISetOnEvent(
$GUI_EVENT_DROPPED,
"GetDroppedItem")
$nTPChecked = 0
GUIRegisterMsg(
$WM_SYSCOMMAND,
"WM_SYSCOMMAND")
CreateSystemMenuItem(
"", -1, false, 0)
$am_img_butts = CreateSystemMenuItem(
"&Images on (some) buttons [requires a restart]", -1, false, 0)
ToggleImgButts()
ToggleImgButts()
CreateSystemMenuItem(
"", -1, false, 0)
$am_trans = CreateSystemMenuItem(
"&Transparency..", -1, true, 0)
for
$i = 0 to 9
$arTransItems[
$i] = CreateSystemMenuItem(
$i * 10 &
"%",
$am_trans)
if
$i =
$user_trans / 10 then
$nTPChecked =
$arTransItems[
$i]
CheckMenuItem(
$am_trans,
$nTPChecked,
$MF_CHECKED)
endif
next
CreateSystemMenuItem(
"", -1, false, 0)
$am_on_top = CreateSystemMenuItem(
"Al&ways on top", -1, false, 0)
CreateSystemMenuItem(
"", -1, false, 0)
$am_overwrite = CreateSystemMenuItem(
"O&verwrite existing files", -1, false, 0)
CreateSystemMenuItem(
"", -1, false, 0)
$am_about = CreateSystemMenuItem(
"&About " &
$my_name, -1, false, 0)
$label_infile = GUICtrlCreateLabel(
"input:", 10, 12)
GUICtrlSetTip(-1,
" enter the full path to the input file (or just drag it in).")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKTOP,
$GUI_DOCKSIZE))
$in_infile = GUICtrlCreateInput(
$infile, 48, 10,
$width-90, 18)
GUICtrlSetTip(-1,
" enter the full path to the input file")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKTOP,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
GUICtrlSetState(-1,
$GUI_DROPACCEPTED)
if
$image_buttons =
"true" then
$butt_infile = GUICtrlCreateButton(
"...",
$width-30, 10, 20, 20,
$BS_ICON)
if @compiled then
GUICtrlSetImage(-1,
$me_app,
$folder_icon_index, 0)
else
GUICtrlSetImage(-1,
".\icons\document-outline.ico", -1, 0)
endif
else
$butt_infile = GUICtrlCreateButton(
"...",
$width-30, 10, 20, 20)
endif
GUICtrlSetTip(-1,
" browse to locate the input file")
GUICtrlSetOnEvent(-1,
"BrowseInFile")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
$label_outfile = GUICtrlCreateLabel(
"output: ", 10, 40)
GUICtrlSetTip(-1,
" enter the full path to the output file.")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKTOP,
$GUI_DOCKSIZE))
$in_outfile = GUICtrlCreateInput(
$outfile, 49, 40,
$width-110, 18)
GUICtrlSetTip(-1,
" enter the full path to the output file ")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKTOP,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
if
$image_buttons =
"true" then
$chk_butt_matof = GUICtrlCreateCheckbox(
"",
$width-55, 40, 20, 20, BitOr(
$BS_AUTOCHECKBOX,
$BS_PUSHLIKE,
$BS_ICON))
if @compiled then
GUICtrlSetImage(-1,
$me_app,
$magic_butt, 0)
else
GUICtrlSetImage(-1,
".\icons\magic-wand.ico", -1, 0)
endif
else
$chk_butt_matof = GUICtrlCreateCheckbox(
"!!!",
$width-55, 40, 20, 20, BitOr(
$BS_AUTOCHECKBOX,
$BS_PUSHLIKE))
endif
GUICtrlSetTip(-1,
" Magic Auto-Transforming Output Filename [MATOF]" & @CRLF & _
" check this to have the output file automatically transformed when you change stuff below " & @CRLF & _
" (handy for doing lots of quick tests) " )
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
GUICtrlSetState(-1,
$matof_status)
GUICtrlSetOnEvent(-1,
"ToggleMatofStatus")
if
$image_buttons =
"true" then
$butt_outfile = GUICtrlCreateButton(
"...",
$width-30, 40, 20, 20,
$BS_ICON)
if @compiled then
GUICtrlSetImage(-1,
$me_app,
$folder_icon_index, 0)
else
GUICtrlSetImage(-1,
".\icons\document-outline.ico", -1, 0)
endif
else
$butt_outfile = GUICtrlCreateButton(
"...",
$width-30, 40, 20, 20)
endif
GUICtrlSetTip(-1,
" browse to specify the output file ")
GUICtrlSetOnEvent(-1,
"BrowseOutFile")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
$group_input = GUICtrlCreateGroup(
"input parameter override.. ", 10, 72,
$column_two-15, 64)
GUICtrlSetResizing(-1,
$GUI_DOCKALL)
$this_help =
" if you need to specify special parameters for the input file, do that here. " & @CRLF & _
" note: these parameters will usually override output parameters, forcing whatever you specify, here. "$label_in_raw = GUICtrlCreateLabel(
"input parameters: ", 15, 90)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$in_input_params = GUICtrlCreateInput(
"", 15, 108,
$column_two-30, 20)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$group_presets = GUICtrlCreateGroup(
"presets.. ",
$column_two, 72,
$width-
$column_two-10, 64)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
$combo_presets = GUICtrlCreateCombo(
"",
$column_two+10, 90,(
$width-
$column_two)-120, 20, BitOR(
$CBS_SORT,
$CBS_DROPDOWN,
$CBS_AUTOHSCROLL,
$WS_VSCROLL))
GUICtrlSetTip(-1,
" select a preset from the list " & @CRLF & _
" the selected preset can either replace or add to the current settings " & @CRLF & _
" note: once selected, you can use your arrow keys to navigate this control " )
GUICtrlSetOnEvent(-1,
"ComboLoadPreset")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
UpdatePresets()
$butt_preset_save = GUICtrlCreateButton(
"save",
$width-105 , 90, 42, 22, -1,
$WS_EX_TOPMOST)
GUICtrlSetTip(-1,
" save these settings as a preset (aka 'favourites') ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"SavePreset")
$butt_preset_wipe = GUICtrlCreateButton(
"wipe",
$width-59 , 90, 42, 22, -1,
$WS_EX_TOPMOST)
GUICtrlSetTip(-1,
" remove this preset from the list ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"WipePreset")
$label_preset_mode = GUICtrlCreateLabel(
"presets..",
$column_two+10, 116, 42, 18, -1,
$WS_EX_TOPMOST)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$radio_preset_replace = GUICtrlCreateRadio(
"replace",
$column_two+54, 114, 54, 18, -1)
GUICtrlSetTip(-1,
" the selected preset will replace all the current settings ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"TogglePresetMode")
GUICtrlSetState(-1,
$replace_mode)
$radio_preset_add = GUICtrlCreateRadio(
"add to",
$column_two+112, 114, 54, 18, -1)
GUICtrlSetTip(-1,
" the selected preset will ADD to all the current settings ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"TogglePresetMode")
if
$replace_mode =
$GUI_UNCHECKED then GUICtrlSetState(-1,
$GUI_CHECKED)
$label_preset_mode2 = GUICtrlCreateLabel(
"..my settings.",
$column_two+166, 116, 100, 18, -1,
$WS_EX_TOPMOST)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$chk_store_filepaths = GUICtrlCreateCheckbox(
"with file paths",
$width-104, 114, 90, 18, -1,
$WS_EX_TOPMOST)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"ToggleStorePaths")
GUICtrlSetTip(-1,
" store the full path of the input and output files inside the preset " & @LF & _
" and restore those file paths along with the preset. ")
if
$store_filepaths <>
"-" then
GUICtrlSetState(-1,
$store_filepaths)
else
GUICtrlSetState(-1,
$GUI_DISABLE)
endif
$out_top = 66
$out_left = 10
$group_output = GUICtrlCreateGroup(
"output parameter override.. ",
$out_left,
$out_top+72,
$width-20, 150)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
$this_help =
" override the output video codec here "$label_v_codec = GUICtrlCreateLabel(
"video codec: ",
$out_left+6,
$out_top+90)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$combo_v_codec = GUICtrlCreateCombo(
$v_codec,
$out_left+5,
$out_top+106, 128, 20, BitOR(
$CBS_SORT,
$CBS_DROPDOWN,
$CBS_AUTOHSCROLL,
$WS_VSCROLL))
GUICtrlSetTip(-1,
$this_help & @CRLF &
" select a preset codec from the list, or enter one manually ")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetData(-1,
$ini_v_codecs)
$this_help =
" override the output video bitrate(bits/s) "$label_v_bitrate = GUICtrlCreateLabel(
"bitrate: ",
$out_left+142,
$out_top+90)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$combo_v_bitrate = GUICtrlCreateCombo(
"",
$out_left+142,
$out_top+106, 42, 20)
GUICtrlSetTip(-1,
$this_help & @CRLF &
" select a preset bitrate from the list, or enter one manually ")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetData(-1,
$v_bitrates)
$this_help =
" override the output video fps (frames per second) "$label_v_fps = GUICtrlCreateLabel(
"fps: ",
$out_left+194,
$out_top+90)
GUICtrlSetTip(-1,
$this_help & @CRLF &
" select a preset bitrate from the list, or enter one manually ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$combo_v_fps = GUICtrlCreateCombo(
"",
$out_left+194,
$out_top+106, 42, 20)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetData(-1,
$v_fps)
$this_help =
" crop the video.."$label_cropping = GUICtrlCreateLabel(
"crop the video.. ",
$out_left+241,
$out_top+90)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$in_crop_top = GUICtrlCreateInput(
"",
$out_left+275,
$out_top+106, 33, 20,
$ES_NUMBER)
GUICtrlSetTip(-1,
" Crop the TOP of the video ")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$in_crop_right = GUICtrlCreateInput(
"",
$out_left+309,
$out_top+127, 33, 20,
$ES_NUMBER)
GUICtrlSetTip(-1,
" Crop the RIGHT side of the video")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$in_crop_bottom = GUICtrlCreateInput(
"",
$out_left+275,
$out_top+148, 33, 20,
$ES_NUMBER)
GUICtrlSetTip(-1,
" Crop the BOTTOM of the video")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$in_crop_left = GUICtrlCreateInput(
"",
$out_left+242,
$out_top+127, 33, 20,
$ES_NUMBER)
GUICtrlSetTip(-1,
" Crop the LEFT side of the video")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$this_help =
" rescale the video width "$label_x_size = GUICtrlCreateLabel(
"resize x: ",
$out_left+350,
$out_top+90)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$in_x_size = GUICtrlCreateInput(
"",
$out_left+350,
$out_top+106, 33, 20,
$ES_NUMBER)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$resize_label = GUICtrlCreateLabel(
"x",
$out_left+389,
$out_top+108)
GUICtrlSetResizing(-1,
$GUI_DOCKALL)
$this_help =
" rescale the video height "$label_y_size = GUICtrlCreateLabel(
"resize y: ",
$out_left+400,
$out_top+90)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$in_y_size = GUICtrlCreateInput(
"",
$out_left+400,
$out_top+106, 33, 20,
$ES_NUMBER)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$this_help =
" .. or you can select a named preset size from the list (if you know what they mean!) "$label_resizing_order = GUICtrlCreateLabel(
"preset sizes: ",
$out_left+350,
$out_top+132)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$combo_preset_resizes = GUICtrlCreateCombo(
$resize_preset,
$out_left+350,
$out_top+148, 64, 20)
GUICtrlSetTip(-1,
$this_help & @CRLF &
" note: this will override the manual settings (above) ")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetData(-1,
$ini_preset_resizes)
$chk_resize_order = GUICtrlCreateCheckbox(
"resize first",
$out_left+260,
$out_top+169)
GUICtrlSetTip(-1,
" check this to resize the video BEFORE the cropping operation (it depends on how your logic goes).." & @CRLF & _
" the order of things affects the dimensions. you might crop THEN resize, or you might change that here. ")
GUICtrlSetonEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKTOP,
$GUI_DOCKSIZE))
GUICtrlSetState(
$chk_resize_order,
$resize_order)
$this_help =
" override the output audio codec here "$label_a_codec = GUICtrlCreateLabel(
"audio codec: ",
$out_left+6,
$out_top+132)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$combo_a_codec = GUICtrlCreateCombo(
$a_codec,
$out_left+5,
$out_top+148, 128, 20, BitOR(
$CBS_SORT,
$CBS_DROPDOWN,
$CBS_AUTOHSCROLL,
$WS_VSCROLL))
GUICtrlSetTip(-1,
$this_help & @CRLF &
" select a preset codec from the list, or enter one manually ")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetData(-1,
$ini_a_codecs)
$this_help =
" override the output audio bitrate (Hz) "$label_a_bitrate = GUICtrlCreateLabel(
"bitrate: ",
$out_left+142,
$out_top+132)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$combo_a_bitrate = GUICtrlCreateCombo(
"",
$out_left+142,
$out_top+148, 42, 20)
GUICtrlSetTip(-1,
$this_help & @CRLF &
" select a preset bitrate from the list, or enter one manually ")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetData(-1,
$a_bitrates)
$this_help =
" allow ffmpeg to automatically set all the options for THIS file type " & @CRLF & _
" (you can also override individual parameters manually, so long as they are compatible with the target file type) "$label_target_types = GUICtrlCreateLabel(
"quick config types: ",
$out_left+5,
$out_top+174)
GUICtrlSetTip(-1,
$this_help )
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$combo_target_type = GUICtrlCreateCombo(
"",
$out_left+6,
$out_top+190, 128, 20)
GUICtrlSetTip(-1,
$this_help)
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetData(-1,
$target_types)
$this_help =
" feel free to add any other command-line parameters here "$label_raw_params = GUICtrlCreateLabel(
"extra parameters.. ",
$out_left+142,
$out_top+174)
GUICtrlSetTip(-1,
$this_help )
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$in_raw_params = GUICtrlCreateInput(
"",
$out_left+141,
$out_top+190,
$width-170, 20)
GUICtrlSetTip(-1,
$this_help & @CRLF &
" there are loads of things you could put here - check the manual! ")
GUICtrlSetOnEvent(-1,
"CreateArgs")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKRIGHT,
$GUI_DOCKSIZE))
$butt_help = GUICtrlCreateButton(
"?",
$out_left+230,
$out_top+170, 18, 18)
GUICtrlSetTip(-1,
" click this button to view the help file in the console output window (below) " & @LF & _
" Shift-click to instead open the help file in your default .nfo file viewer ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"HelpMe")
$butt_reset = GUICtrlCreateButton(
"&reset",
$out_left+
$width-65,
$out_top+84, 40, 20)
GUICtrlSetTip(-1,
" click this button (or hit alt+r to reset all the parameters" )
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKRIGHT,
$GUI_DOCKTOP,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"WipeSettings")
$label_commandline = GUICtrlCreateLabel(
"command-line input: ", 10,
$out_top+230)
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKRIGHT,
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$edit_in_args = GUICtrlCreateEdit(
"", 10,
$out_top+246,
$width-20, 64, BitOr(
$ES_MULTILINE,
$ES_READONLY))
GUICtrlSetTip(-1,
" this is the actual command-line that will be used. ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKRIGHT,
$GUI_DOCKTOP,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
$chk_console_output = GUICtrlCreateCheckbox(
"console output..", 10,
$out_top+318, 100, 18)
GUICtrlSetTip(-1,
" display progress and final console output below.. ")
GUICtrlSetonEvent(-1,
"ToggleConsoleOutput")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKTOP,
$GUI_DOCKSIZE))
GUICtrlSetState(-1,
$do_console_readout)
$edit_out = GUICtrlCreateEdit(
"", 10,
$out_top+336,
$width-20,
$height-(
$out_top+378), _
BitOR(
$WS_VSCROLL,
$WS_HSCROLL,
$ES_AUTOVSCROLL,
$ES_AUTOHSCROLL,
$ES_MULTILINE,
$ES_WANTRETURN))
GUICtrlSetTip(-1,
" you can see the output from ffmpeg here, including any errors, etc. ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKRIGHT,
$GUI_DOCKTOP,
$GUI_DOCKBOTTOM,
$GUI_DOCKLEFT,
$GUI_DOCKSIZE))
GUICtrlSetLimit(-1, 65535)
$chk_log_append = GUICtrlCreateCheckbox(
"append log", 140,
$out_top+318, 128, 18)
GUICtrlSetTip(-1,
" append the log output to the end of the session log (it could get big!) ")
GUICtrlSetonEvent(-1,
"ToggleLogAppend")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKTOP,
$GUI_DOCKSIZE))
GUICtrlSetState(-1,
$log_append)
$butt_find = GUICtrlCreateButton(
"&search in output", 10,
$height-32, 90, 24)
GUICtrlSetTip(-1,
" click this button to find text inside the output window (or use Ctrl+F or Alt+S)")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKBOTTOM,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"FindInOutput")
GUICtrlSetState(-1,
$GUI_HIDE)
$butt_copy2clip = GUICtrlCreateButton(
"copy ou&tput to clipboard",
$half_width-88,
$height-33, 125, 24)
GUICtrlSetTip(-1,
" click this button to copy the contents of the output window to the clipboard (or use Alt+T)")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKRIGHT,
$GUI_DOCKBOTTOM,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"CopyOutput")
GUICtrlSetState(-1,
$GUI_HIDE)
$butt_clearout = GUICtrlCreateButton(
"&clear",
$half_width+40,
$height-33, 32, 24)
GUICtrlSetTip(-1,
" click this button to clear the output window (or use Alt+C) ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKRIGHT,
$GUI_DOCKBOTTOM,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"ClearOutput")
GUICtrlSetState(-1,
$GUI_HIDE)
if
$ffmpeg_loc then
$butt_doit = GUICtrlCreateButton(
"&Do It!",
$width-82,
$height-32, 72, 24, -1,
$WS_EX_TOPMOST)
GUICtrlSetTip(-1,
" click this button (or hit F1 or alt+d) to begin the encoding process ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKRIGHT,
$GUI_DOCKBOTTOM,
$GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1,
"DoIt")
endif
$label_abort = GUICtrlCreateLabel(
"to abort, press 'q'.", 10,
$height-32)
GUICtrlSetTip(-1,
" simply hit 'q' on your keyboard to quit the encoding process ")
GUICtrlSetResizing(-1, BitOr(
$GUI_DOCKLEFT,
$GUI_DOCKBOTTOM,
$GUI_DOCKSIZE))
GUICtrlSetState(-1,
$GUI_HIDE)
ToggleConsoleOutput()
ToggleOnTop()
ToggleOnTop()
ToggleOverwite()
ToggleOverwite()
WinSetTrans(
$ffeGUI,
"", 255 * (100 -
$user_trans) / 100)
SetHotKeys()
CheckSize()
GUISetState()
LoadPreset(
$launch_preset)
if
$infile then FillOutputFile()
CreateArgs()
if
$launch_preset and
$go and
$infile then DoIt()
while 1
Sleep(333)
wend
func CreateArgs()
$infile = GUICtrlRead(
$in_infile)
$outfile = GUICtrlRead(
$in_outfile)
$out_args = GUICtrlRead(
$in_raw_params)
$matof_string =
"" if GUICtrlRead(
$in_input_params) <>
"" then
$matof_string &=
"[in=" & GUICtrlRead(
$in_input_params) &
"]" endif
if GUICtrlRead(
$chk_resize_order) =
$GUI_CHECKED then
AddSizing()
AddCropping()
else
AddCropping()
AddSizing()
endif
$read_vcodec = GUICtrlRead(
$combo_v_codec)
$read_acodec = GUICtrlRead(
$combo_a_codec)
if StringInStr(
$read_vcodec,
"disable") then
$out_args &=
" -vn " $no_video = true
if StringInStr(
$read_acodec,
"disable") then
GUICtrlSetData(
$combo_a_codec,
$ini_a_codecs)
$read_acodec = GUICtrlRead(
$combo_a_codec)
endif
else
$no_video = false
endif
if StringInStr(
$read_acodec,
"disable") then
$out_args &=
" -an " $no_audio = true
else
$no_audio = false
endif
if GUICtrlRead(
$combo_target_type) <>
"" then
$out_args &=
" -target " & GUICtrlRead(
$combo_target_type)
$matof_string &=
"[" & GUICtrlRead(
$combo_target_type) &
"]" $no_video = false
endif
if
$read_vcodec <>
"" and not StringInStr(
$read_vcodec,
"disable") then
$v_codec =
" -vcodec " &
$read_vcodec $matof_string &=
"[" &
$read_vcodec &
"]" else
$v_codec =
"" endif
if not
$no_video then
if GUICtrlRead(
$combo_v_bitrate) <>
"" then
$out_args &=
" -b " & GUICtrlRead(
$combo_v_bitrate)
$matof_string &=
"[" & GUICtrlRead(
$combo_v_bitrate) &
"]" endif
if GUICtrlRead(
$combo_v_fps) <>
"" then
$out_args &=
" -r " & GUICtrlRead(
$combo_v_fps)
$matof_string &=
"[" & GUICtrlRead(
$combo_v_fps) &
"]" endif
endif
if not
$no_audio then
if
$read_acodec <>
"" then
$a_codec =
" -acodec " &
$read_acodec else
$a_codec =
"" endif
if
$read_acodec <>
"" then
$matof_string &=
"[" &
$read_acodec &
"]" if GUICtrlRead(
$combo_a_bitrate) <>
"" then
$out_args &=
" -ab " & GUICtrlRead(
$combo_a_bitrate)
if not
$no_video then
$matof_string &=
"[" & GUICtrlRead(
$combo_a_bitrate) &
"]" endif
endif
if
$overwrite =
$GUI_CHECKED then
$out_args &=
" -y " if GUICtrlRead(
$in_raw_params) <>
"" then
$matof_string &=
"[" & GUICtrlRead(
$in_raw_params) &
"]" endif
if
$old_matof <>
"" then
$clean_outfile = StringReplace(
$outfile,
$matof_separator &
$old_matof,
"")
else
$clean_outfile =
"" endif
if
$clean_outfile =
"" then
$clean_outfile =
$outfile $matof_outfile =
$clean_outfile if
$matof_status =
$GUI_CHECKED then
if (
$outfile <>
"") and (
$matof_string <>
"") then
$clean_outfile_ext = GetExtension(
$clean_outfile)
$clean_outfile_noext = RemoveExtension(
$clean_outfile)
$clean_outfile_ext = GetExtFromCodec(
$read_vcodec)
if
$no_video then
$matof_string = StringReplace(
$matof_string,
"[" &
$clean_outfile_ext &
"]",
"")
endif
if
$matof_string =
"" then
$separator =
"" else
$separator =
$matof_separator endif
$matof_outfile =
$clean_outfile_noext &
$separator &
$matof_string &
"." &
$clean_outfile_ext $old_matof =
$matof_string endif
endif
GUICtrlSetData(
$in_outfile,
$matof_outfile)
$args =
$ffmpeg_loc &
" " & GUICtrlRead(
$in_input_params) &
" -i " &
"""" &
$infile &
"""" &
$v_codec & _
" " &
$a_codec &
" " &
$out_args &
" " &
"""" &
$matof_outfile &
"""" GUICtrlSetData(
$edit_in_args,
$args)
endfunc
func AddSizing()
$resize =
"" $matof_tmp_string =
"" $x_size = GUICtrlRead(
$in_x_size)
$y_size = GUICtrlRead(
$in_y_size)
if
$x_size and
$y_size then
$resize =
$x_size &
"x" &
$y_size $matof_tmp_string =
"[" &
$resize &
"]" endif
if GUICtrlRead(
$combo_preset_resizes) <>
"" then
$resize = GUICtrlRead(
$combo_preset_resizes)
$matof_tmp_string =
"[size=" &
$resize &
"]" endif
$matof_string &=
$matof_tmp_string if
$resize <>
"" then
$out_args &=
" -s " &
$resizeendfunc
func AddCropping()
$matof_tmp_string =
"[crop " if GUICtrlRead(
$in_crop_top) then
$out_args &=
" -croptop " & GUICtrlRead(
$in_crop_top)
$matof_tmp_string &=
"t=" & GUICtrlRead(
$in_crop_top) &
" endif
if GUICtrlRead(
$in_crop_right) then
$out_args &=
" -cropright " & GUICtrlRead(
$in_crop_right)
$matof_tmp_string &=
"r=" & GUICtrlRead(
$in_crop_right) &
" endif
if GUICtrlRead(
$in_crop_bottom) then
$out_args &=
" -cropbottom " & GUICtrlRead(
$in_crop_bottom)
$matof_tmp_string &=
"b=" & GUICtrlRead(
$in_crop_bottom) &
" endif
if GUICtrlRead(
$in_crop_left) then
$out_args &=
" -cropleft " & GUICtrlRead(
$in_crop_left)
$matof_tmp_string &=
"l=" & GUICtrlRead(
$in_crop_left) &
" endif
$matof_tmp_string = StringTrimRight(
$matof_tmp_string, 1)
$matof_tmp_string &=
"]" if
$matof_tmp_string <>
"[crop]" then
$matof_string &=
$matof_tmp_stringendfunc
func GetExtFromCodec(
$v_codec)
switch
$v_codec case
$v_codec =
"copy" $this_ext = GetExtension(
$infile)
case
$v_codec =
"flv" $this_ext =
"flv" case
$v_codec =
"mpegvideo",
"mpeg1video",
"mpeg2video" $this_ext =
"mpg" case
$v_codec =
"flic" $this_ext =
"flc" case
$v_codec =
"wmv1",
"wmv2" $this_ext =
"wmv" case
$v_codec =
"h264" $this_ext =
"mp4" case else
$this_ext =
"avi" endswitch
if StringInStr(
$out_args,
"-vn") then
switch GUICtrlRead(
$combo_a_codec)
case 'flac'
$this_ext = 'fla'
case 'mp3'
$this_ext = 'mp3'
case 'mp2'
$this_ext = 'mp2'
case 'ac3'
$this_ext = 'ac3'
case 'aac'
$this_ext = 'aac'
case 'tta'
$this_ext = 'tta'
case else
$this_ext = 'wav'
endswitch
endif
return
$this_extendfunc
func DoIt()
CreateArgs()
if
$infile =
"" then
if (BrowseInFile() = 0) then return
DoIt()
return
endif
if
$outfile =
"" then
if (BrowseOutFile() = 0) then return
DoIt()
return
endif
if
$infile =
$outfile then
MsgBox(0,
"file name clash!",
"You will need to choose a different output filename.. ")
if (BrowseOutFile() = 0) then return
DoIt()
return
endif
UnSetHotKeys()
ClearOutput()
DisableDoItButt()
GUICtrlSetState(
$label_abort,
$GUI_SHOW)
WinSetTitle(
$ffeGUI,
"",
$my_title &
" [press 'q' to abort]")
HotKeySet(
"q",
"FFmpegAbort")
HotKeySet(
"y",
"FFmpegResponseYes")
HotKeySet(
"n",
"FFmpegResponseNo")
$ffmpeg = Run(
$args, @ScriptDir, @SW_HIDE, BitOr(
$STDERR_CHILD,
$STDIN_CHILD))
$timestamp = TimerInit()
while 1
$console_out = StderrRead(
$ffmpeg)
if @error then exitloop
if StringInStr(
$console_out,
"already exists. Overwrite ? [y/N]") then
WinActivate(
$ffeGUI)
WinSetTitle(
$ffeGUI,
"",
$my_title &
" [Overwrite existing file? (hit 'y' or 'n')]")
endif
if
$console_out then
if GUICtrlRead(
$chk_console_output) <> 0 then GUICtrlSetData(
$edit_out,
$console_out)
DoLog(
$console_out)
endif
wend
DoLog(
"Completed in " & Round(TimerDiff (
$timestamp) / 1000, 2) &
" seconds")
DoLog(
"out", GUICtrlRead(
$chk_log_append),
"command-line: " &
$args & @CRLF & @CRLF)
HotKeySet(
"q")
HotKeySet(
"y")
HotKeySet(
"n")
WinSetTitle(
$ffeGUI,
"",
$my_title )
GUICtrlSetState(
$label_abort,
$GUI_HIDE)
GUICtrlSetData(
$edit_out, FileRead(
$log_file))
_GUICtrlEdit_Scroll(
$edit_out,
$__EDITCONSTANT_SB_SCROLLCARET)
SetHotKeys()
if GUICtrlRead(
$chk_console_output) =
$GUI_CHECKED then ShowOutputButts()
EnableDoItButt()
endfunc
func ComboLoadPreset()
LoadPreset()
endfunc
func LoadPreset(
$or_preset=
"")
local
$param if
$or_preset then
$this_preset =
$or_preset GUICtrlSetData(
$combo_presets,
$or_preset)
else
$this_preset = GUICtrlRead(
$combo_presets)
$store_filepaths = GUICtrlRead(
$chk_store_filepaths)
endif
if
$this_preset =
"" then
$this_preset =
$my_name if
$infile then
GUICtrlSetData(
$in_infile,
$infile)
FillOutputFile()
elseif
$store_filepaths =
$GUI_CHECKED then
$param = IniRead(
$ini_path,
$this_preset,
"infile",
"")
if
$param <>
"" then GUICtrlSetData(
$in_infile,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"outfile",
"")
if
$param <>
"" then GUICtrlSetData(
$in_outfile,
$param)
endif
if
$replace_mode =
$GUI_CHECKED then WipeSettings()
$param = IniRead(
$ini_path,
$this_preset,
"input_params",
"")
if
$param <>
"" then GUICtrlSetData(
$in_input_params,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"v_codec",
"")
if
$param <>
"" then GUICtrlSetData(
$combo_v_codec,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"v_bitrate",
"")
if
$param <>
"" then GUICtrlSetData(
$combo_v_bitrate,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"v_fps",
"")
if
$param <>
"" then GUICtrlSetData(
$combo_v_fps,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"x_size",
"")
if
$param <>
"" then GUICtrlSetData(
$in_x_size,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"y_size",
"")
if
$param <>
"" then GUICtrlSetData(
$in_y_size,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"preset_resize",
"")
if
$param <>
"" then GUICtrlSetData(
$combo_preset_resizes,
$param)
$param = IniReadCheckBoxValue(
$ini_path,
$this_preset,
"resize_order",
"")
if
$param <>
"" then GUICtrlSetState(
$chk_resize_order,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"crop_top",
"")
if
$param <>
"" then GUICtrlSetData(
$in_crop_top,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"crop_left",
"")
if
$param <>
"" then GUICtrlSetData(
$in_crop_left,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"crop_right",
"")
if
$param <>
"" then GUICtrlSetData(
$in_crop_right,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"crop_bottom",
"")
if
$param <>
"" then GUICtrlSetData(
$in_crop_bottom,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"a_codec",
"")
if
$param <>
"" then GUICtrlSetData(
$combo_a_codec,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"a_bitrate",
"")
if
$param <>
"" then GUICtrlSetData(
$combo_a_bitrate,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"target_type",
"")
if
$param <>
"" then GUICtrlSetData(
$combo_target_type,
$param)
$param = IniRead(
$ini_path,
$this_preset,
"raw_params",
"")
if
$param <>
"" then GUICtrlSetData(
$in_raw_params,
$param)
CreateArgs()
endfunc
func UpdatePresets()
$presets_string =
"" $presets = IniReadSectionNames(
$ini_path)
if not IsArray(
$presets) then return
for
$i = 0 to
$presets[0]-1
if not StringInStr(
$presets_string,
$presets[
$i+1]) then
$presets_string &=
$presets[
$i+1] &
"|" next
if StringRight(
$presets_string, 1) =
"|" then
$presets_string = StringTrimRight(
$presets_string, 1)
GUICtrlSetData(
$combo_presets,
"")
GUICtrlSetData(
$combo_presets,
$presets_string)
endfunc
func SavePreset()
$this_preset = GUICtrlRead(
$combo_presets)
if
$this_preset =
$my_name then
UnSetHotKeys()
$replace_defaults = MsgBox(4,
"Are you SURE?",
"If you use the name " &
$my_name &
", your settings will become the defaults, " & _
@CRLF &
"and will be loaded automatically at startup. Is this what you want?")
SetHotKeys()
if
$replace_defaults = 7 then return
endif
if
$this_preset =
"" then return
$this_preset = StringReplace(
$this_preset,
"[",
"{")
$this_preset = StringReplace(
$this_preset,
"]",
"}")
if StringLeft(
$this_preset, 1) =
" " then
$this_preset = StringTrimLeft(
$this_preset, 1)
$presets = IniReadSectionNames(
$ini_path)
if InArray(
$presets,
$this_preset) and
$this_preset <>
$my_name then
UnSetHotKeys()
$replaceit = MsgBox(4,
"Replace Preset?",
"That preset exists!" & @CRLF &
"Do you wish to replace it?", 30)
SetHotKeys()
if
$replaceit = 7 then return
endif
if GUICtrlRead(
$chk_store_filepaths) =
$GUI_CHECKED then
IniWrite(
$ini_path,
$this_preset,
"infile", GUICtrlRead(
$in_infile))
$clean_filename = StringReplace(GUICtrlRead(
$in_outfile),
$matof_separator &
$old_matof,
"")
IniWrite(
$ini_path,
$this_preset,
"outfile",
$clean_filename)
endif
IniWrite(
$ini_path,
$this_preset,
"input_params", GUICtrlRead(
$in_input_params))
IniWrite(
$ini_path,
$this_preset,
"v_codec", GUICtrlRead(
$combo_v_codec))
IniWrite(
$ini_path,
$this_preset,
"v_bitrate", GUICtrlRead(
$combo_v_bitrate))
IniWrite(
$ini_path,
$this_preset,
"v_fps", GUICtrlRead(
$combo_v_fps))
IniWrite(
$ini_path,
$this_preset,
"x_size", GUICtrlRead(
$in_x_size))
IniWrite(
$ini_path,
$this_preset,
"y_size", GUICtrlRead(
$in_y_size))
IniWrite(
$ini_path,
$this_preset,
"preset_resize", GUICtrlRead(
$combo_preset_resizes))
IniWriteCheckBoxValue(
$ini_path,
$this_preset,
"resize_order", GUICtrlRead(
$chk_resize_order))
IniWrite(
$ini_path,
$this_preset,
"crop_top", GUICtrlRead(
$in_crop_top))
IniWrite(
$ini_path,
$this_preset,
"crop_left", GUICtrlRead(
$in_crop_left))
IniWrite(
$ini_path,
$this_preset,
"crop_right", GUICtrlRead(
$in_crop_right))
IniWrite(
$ini_path,
$this_preset,
"crop_bottom", GUICtrlRead(
$in_crop_bottom))
IniWrite(
$ini_path,
$this_preset,
"a_codec", GUICtrlRead(
$combo_a_codec))
IniWrite(
$ini_path,
$this_preset,
"a_bitrate", GUICtrlRead(
$combo_a_bitrate))
IniWrite(
$ini_path,
$this_preset,
"target_type", GUICtrlRead(
$combo_target_type))
IniWrite(
$ini_path,
$this_preset,
"raw_params", GUICtrlRead(
$in_raw_params))
UpdatePresets()
GUICtrlSetData(
$combo_presets,
$this_preset)
endfunc
func WipePreset()
$this_preset = GUICtrlRead(
$combo_presets)
if
$this_preset <>
$my_name then
IniDelete(
$ini_path,
$this_preset)
else
UnSetHotKeys()
MsgBox(0,
"Not quite!",
"If you wish to reset the default settings, simple hit the reset button" & @CRLF & _
"and then save the (blank) settings to a preset, using the name " &
$my_name &
"")
SetHotKeys()
endif
UpdatePresets()
return
endfunc
func WipeSettings()
GUICtrlSetData(
$in_input_params,
"")
GUICtrlSetData(
$combo_v_codec,
$ini_v_codecs)
GUICtrlSetData(
$combo_v_bitrate,
$v_bitrates)
GUICtrlSetData(
$combo_v_fps,
$v_fps)
GUICtrlSetData(
$in_x_size,
"")
GUICtrlSetData(
$in_y_size,
"")
GUICtrlSetData(
$in_crop_top,
"")
GUICtrlSetData(
$in_crop_left,
"")
GUICtrlSetData(
$in_crop_right,
"")
GUICtrlSetData(
$in_crop_bottom,
"")
GUICtrlSetData(
$combo_a_codec,
$ini_a_codecs)
GUICtrlSetData(
$combo_a_bitrate,
$a_bitrates)
GUICtrlSetData(
$combo_target_type,
$target_types)
GUICtrlSetData(
$combo_preset_resizes,
$ini_preset_resizes)
GUICtrlSetState(
$chk_resize_order,
$GUI_UNCHECKED)
GUICtrlSetData(
$in_raw_params,
"")
CreateArgs()
endfunc
func HelpMe()
FileInstall(
".\stuff\help.nfo",
$data_parent &
"\help.nfo", 0)
if ce_IsPressed(10) then
ShellExecute(
$data_parent &
"\help.nfo")
return
endif
if GUICtrlRead(
$chk_console_output) =
$GUI_UNCHECKED then
GUICtrlSetState(
$chk_console_output,
$GUI_CHECKED)
ToggleConsoleOutput()
endif
GUICtrlSetData(
$edit_out, FileRead(
$data_parent &
"\help.nfo"))
ShowOutputButts()
endfunc
func ShowOutputButts()
GUICtrlSetState(
$butt_copy2clip,
$GUI_SHOW)
GUICtrlSetState(
$butt_clearout,
$GUI_SHOW)
GUICtrlSetState(
$butt_find,
$GUI_SHOW)
endfunc
func HideOutputButts()
GUICtrlSetState(
$butt_copy2clip,
$GUI_HIDE)
GUICtrlSetState(
$butt_clearout,
$GUI_HIDE)
GUICtrlSetState(
$butt_find,
$GUI_HIDE)
endfunc
func EnableDoItButt()
if
$ffmpeg_loc then GUICtrlSetState(
$butt_doit,
$GUI_ENABLE)
endfunc
func DisableDoItButt()
GUICtrlSetState(
$butt_doit,
$GUI_DISABLE)
endfunc
func CopyOutput()
if GUICtrlRead(
$edit_out) <>
"" then ClipPut(GUICtrlRead(
$edit_out))
endfunc
func ClearOutput()
GUICtrlSetData(
$edit_out,
"")
HideOutputButts()
endfunc
func TogglePresetMode()
if GUICtrlRead(
$radio_preset_replace) =
$GUI_CHECKED then
$replace_mode =
$GUI_CHECKED else
$replace_mode =
$GUI_UNCHECKED endif
IniWriteCheckBoxValue(
$ini_path,
$my_name,
"replace_mode",
$replace_mode)
endfunc
func ToggleMatofStatus()
if GUICtrlRead(
$chk_butt_matof) =
$GUI_CHECKED then
$matof_status =
$GUI_CHECKED if (
$infile <>
"") and (
$outfile =
"") then FillOutputFile()
else
$matof_status =
$GUI_UNCHECKED endif
IniWrite(
$ini_path,
$my_name,
"matof_status",
$matof_status)
CreateArgs()
endfunc
func ToggleConsoleOutput()
if GUICtrlRead(
$chk_console_output) =
$GUI_UNCHECKED then
GUICtrlSetState(
$edit_out,
$GUI_HIDE)
HideOutputButts()
else
GUICtrlSetState(
$edit_out,
$GUI_SHOW)
if GUICtrlRead(
$edit_out) <>
"" then ShowOutputButts()
endif
IniWriteCheckBoxValue(
$ini_path,
$my_name,
"console_output", GUICtrlRead(
$chk_console_output))
endfunc
func ToggleLogAppend()
IniWriteCheckBoxValue(
$ini_path,
$my_name,
"log_append", GUICtrlRead(
$chk_log_append))
endfunc
func ToggleStorePaths()
IniWriteCheckBoxValue(
$ini_path,
$my_name,
"store_filepaths", GUICtrlRead(
$chk_store_filepaths))
endfunc
func MenuToggleOverwite()
ToggleOverwite(false)
endfunc
func ToggleOverwite(
$flip=true)
$hMenu = GetSystemMenu(
$ffeGUI, 0)
if
$overwrite =
$GUI_UNCHECKED then
$overwrite =
$GUI_CHECKED CheckMenuItem(
$hMenu,
$am_overwrite, 8)
else
$overwrite =
$GUI_UNCHECKED CheckMenuItem(
$hMenu,
$am_overwrite, 0)
endif
if not
$flip then
IniWriteCheckBoxValue(
$ini_path,
$my_name,
"overwrite",
$overwrite)
CreateArgs()
endif
endfunc
func MenuToggleOnTop()
ToggleOnTop(false)
endfunc
func ToggleOnTop(
$flip=true)
$hMenu = GetSystemMenu(
$ffeGUI, 0)
if
$on_top =
$GUI_UNCHECKED then
WinSetOnTop(
$ffeGUI,
"", 1)
$on_top =
$GUI_CHECKED CheckMenuItem(
$hMenu,
$am_on_top, 8)
else
WinSetOnTop(
$ffeGUI,
"", 0)
$on_top =
$GUI_UNCHECKED CheckMenuItem(
$hMenu,
$am_on_top, 0)
endif
if not
$flip then
IniWriteCheckBoxValue(
$ini_path,
$my_name,
"on_top",
$on_top)
endif
endfunc
func ToggleImgButts()
$hMenu = GetSystemMenu(
$ffeGUI, 0)
if
$image_buttons =
"true" then
$image_buttons = false
CheckMenuItem(
$hMenu,
$am_img_butts, 0)
IniWrite(
$ini_path,
$my_name,
"image_buttons",
"false")
else
$image_buttons = true
CheckMenuItem(
$hMenu,
$am_img_butts, 8)
IniWrite(
$ini_path,
$my_name,
"image_buttons",
"true")
endif
endfunc
func GetDroppedItem()
if @GUI_DRAGID = -1 then
if StringInStr(FileGetAttrib(@GUI_DRAGFILE),
"D") then return -1
$infile = @GUI_DRAGFILE
GUICtrlSetData(
$in_infile,
$infile)
FillOutputFile()
CreateArgs()
else
return false
endif
endfunc
func ToggleWindow()
$winstate = WinGetState(
$ffeGUI)
if BitAnd(
$winstate, 2) then
UnSetHotKeys()
GUISetState(@SW_HIDE)
else
GUISetState(@SW_SHOW)
SetHotKeys()
endif
endfunc
func BrowseInFile()
DialogOpen()
$infile = FileOpenDialog(
"locate the input file..",
"",
$filetypes, 1,
"",
$ffeGUI)
DialogClose()
if
$infile <>
"" then
GUICtrlSetData(
$in_infile,
$infile)
FillOutputFile()
CreateArgs()
else
return 0
endif
return 1
endfunc
func BrowseOutFile()
DialogOpen()
$outfile = FileSaveDialog(
"specify the output file..",
"",
$filetypes, 1,
"",
$ffeGUI)
DialogClose()
if
$outfile <>
"" then
GUICtrlSetData(
$in_outfile,
$outfile)
CreateArgs()
else
return 0
endif
return 1
endfunc
func FillOutputFile()
GUICtrlSetData(
$in_outfile, RemoveExtension(GUICtrlRead(
$in_infile)) &
".avi")
endfunc
func GetSystemMenu(
$hWnd,
$bRevert)
local
$hMenu = DllCall(
"user32.dll",
"hwnd",
"GetSystemMenu", _
"hwnd",
$hWnd, _
"int",
$bRevert)
return
$hMenu[0]
endfunc
func InsertMenu(
$hMenu,
$nPosition,
$nFlags,
$nIDNewItem,
$lpNewItem)
local
$nResult = DllCall(
"user32.dll",
"int",
"InsertMenu", _
"hwnd",
$hMenu, _
"int",
$nPosition, _
"int",
$nFlags, _
"int",
$nIDNewItem, _
"str",
$lpNewItem)
return
$nResult[0]
endfunc
func CreatePopupMenu()
local
$hMenu = DllCall(
"user32.dll",
"hwnd",
"CreatePopupMenu")
return
$hMenu[0]
endfunc
func CheckMenuItem(
$hMenu,
$nID,
$nFlags)
DllCall(
"user32.dll",
"int",
"CheckMenuItem",
"hwnd",
$hMenu,
"int",
$nID,
"int",
$nFlags)
endfunc
func CreateSystemMenuItem(
$sText,
$hMenu = -1,
$bIsPopup=false,
$nPos=0xFFFFFFFF)
if
$hMenu = -1 then
$hMenu = GetSystemMenu(
$ffeGUI, 0)
local
$nID = GUICtrlCreateDummy()
local
$nFlags = 0
if
$sText =
"" then
$nFlags =
$MF_SEPARATOR elseif
$bIsPopup then
$nID = CreatePopupMenu()
$nFlags =
$MF_POPUP endif
$nFlags = BitOr(
$MF_BYPOSITION,
$nFlags)
$nResult = InsertMenu(
$hMenu,
$nPos,
$nFlags,
$nID,
$sText)
return
$nIDendfunc
func WM_SYSCOMMAND(
$hWnd,
$Msg,
$wParam,
$lParam)
$nID = BitAnd(
$wParam, 0x0000FFFF)
switch
$nID case
$arTransItems[0] to
$arTransItems[9]
SetTransparency(
$nID)
case
$am_about DoAboutBox()
case
$am_on_top MenuToggleOnTop()
case
$am_overwrite MenuToggleOverwite()
case
$am_img_butts ToggleImgButts()
endswitch
endfunc
func SetTransparency(
$nID)
for
$i = 0 to 9
if
$arTransItems[
$i] =
$nID then exitloop
next
$user_trans = 10 *
$i $trans_level = 255 * (100 -
$user_trans) / 100
WinSetTrans(
$ffeGUI,
"",
$trans_level)
if
$nTPChecked <>
$nID then CheckMenuItem(
$am_trans,
$nTPChecked, 0)
CheckMenuItem(
$am_trans,
$nID,
$MF_CHECKED)
SaveOptTransparency()
$nTPChecked =
$nIDendfunc
func FFmpegResponseYes()
if WinActive(
$my_title) then
StdinWrite(
$ffmpeg,
"y")
WinSetTitle(
$ffeGUI,
"",
$my_title &
" [press 'q' to abort]")
else
HotKeySet(
"y")
Send(
"y")
HotKeySet(
"y",
"FFmpegResponseYes")
endif
endfunc
func FFmpegResponseNo()
if WinActive(
$my_title) then
StdinWrite(
$ffmpeg,
"n")
WinSetTitle(
$ffeGUI,
"",
$my_title &
" [press 'q' to abort]")
else
HotKeySet(
"n")
Send(
"n")
HotKeySet(
"n",
"FFmpegResponseNo")
endif
endfunc
func FFmpegAbort()
if WinActive(
$my_title) then
StdinWrite(
$ffmpeg,
"q" )
ProcessClose(
$ffmpeg)
DoLog(@CRLF &
"user sent abort command!" & @CRLF & @CRLF)
else
HotKeySet(
"q")
Send(
"q")
HotKeySet(
"q",
"FFmpegAbort")
endif
endfunc
func SaveOptTransparency()
IniWrite(
$ini_path,
$my_name,
"transparency",
$user_trans)
endfunc
func ResizeCheckSize()
SaveXYPrefs()
endfunc
func PrimaryUpCheckSize()
CheckSize()
endfunc
func CheckSize(
$save=true)
$size_array = WinGetClientSize(
$ffeGUI)
if not IsArray(
$size_array) then return 0
if
$size_array[0] <
$min_width then WinMove(
$my_title,
"", default, default ,
$min_width+8)
if
$size_array[1] <
$min_height then WinMove(
$my_title,
"", default, default , default,
$min_height+
$height_magic)
Sleep(25)
$size_array = WinGetPos(
$ffeGUI)
if not IsArray(
$size_array) then return 0
if
$size_array[0] < 0 then
WinMove(
$my_title,
"", 0, default)
if
$save then IniWrite(
$ini_path,
$my_name,
"x", 0)
endif
if
$size_array[0] > @DesktopWidth-
$size_array[2] then
WinMove(
$my_title,
"", @DesktopWidth-
$size_array[2], default)
if
$save then IniWrite(
$ini_path,
$my_name,
"x", @DesktopWidth-
$size_array[2])
endif
if
$size_array[1] < 0 then
WinMove(
$my_title,
"", default, 0)
if
$save then IniWrite(
$ini_path,
$my_name,
"y", 0)
endif
if
$size_array[1] > @DesktopHeight-
$size_array[3] then
WinMove(
$my_title,
"", default, @DesktopHeight-
$size_array[3])
if
$save then IniWrite(
$ini_path,
$my_name,
"y", @DesktopHeight-
$size_array[3])
endif
return true
endfunc
func SaveXYPrefs()
if not CheckSize() then return 0
$size_array = WinGetPos(
$ffeGUI)
if not IsArray(
$size_array) then return 0
if
$size_array[0] <>
$x and
$size_array[0] >= 0 and
$size_array[0] < (@desktopWidth-25) then _
IniWrite(
$ini_path,
$my_name,
"x",
$size_array[0])
if
$size_array[1] <>
$y and
$size_array[1] >= 0 and
$size_array[1] < (@desktopHeight-25) then _
IniWrite(
$ini_path,
$my_name,
"y",
$size_array[1])
$size_array = WinGetClientSize(
$ffeGUI)
if not IsArray(
$size_array) then return 0
if
$size_array[0] <>
$width and
$size_array[0] >=
$min_width then IniWrite(
$ini_path,
$my_name,
"width",
$size_array[0])
if
$size_array[1] <>
$height and
$size_array[1] >=
$min_height-
$height_magic then IniWrite(
$ini_path,
$my_name,
"height",
$size_array[1])
endfunc
func DoAboutBox()
DialogOpen()
Opt(
"GUIOnEventMode", 0)
local
$aw = 330,
$ay = 210
$GUI_About = GUICreate(
" about " &
$my_name &
".. ",
$aw,
$ay, -1, @DesktopHeight/4,
$WS_CAPTION,
$WS_EX_TOPMOST,
$ffeGUI)
GUICtrlCreateIcon(
$me_app, 0, 15, 10, 32, 32)
GUICtrlCreateLabel(
$my_name &
" v" &
$my_version & @CRLF & _
chr(169) &
" cor at corz.org 2007-" & @YEAR &
" , 55, 10, 200, 50) GUICtrlCreateLabel(
$my_name &
" is a simple, powerful front-end for ffmpeg, " & _
"enabling quick alterations to its parameters for rapid testing and production. " & @CRLF & @CRLF & _
"ffe uniquely uses MATOF" & chr(153) &
" technology to automatically update output filenames to " & _
"match your encoding parameters, enabling you to save lots of slightly different versions of a file " & _
"very, very quickly & @CRLF & _ @CRLF & _
"Do you want to visit the " &
$my_name &
" web page at this time? ", 15, 50,
$aw-25,
$ay-90)
$GUI_About_NO = GUICtrlCreateButton(
"Nah",
$aw-170,
$ay-25, 75, 20)
$GUI_About_OK = GUICtrlCreateButton(
"Okay",
$aw-85,
$ay-25, 75, 20)
GUICtrlSetState(
$GUI_About_OK,
$GUI_FOCUS)
GUISetState()
while 1
sleep(10)
$msg = GUIGetMsg()
switch
$msg case
$GUI_EVENT_CLOSE,
$GUI_About_NO GUIDelete(
$GUI_About)
ExitLoop
case
$GUI_About_OK VisitURL(
$my_url)
GUIDelete(
$GUI_About)
ExitLoop
endswitch
wend
Opt(
"GUIOnEventMode", 1)
DialogClose()
endfunc
func DoLog(
$dl_string,
$dl_append=4,
$log_extra=
"")
if
$dl_string =
"out" then
if
$log_string <>
"" then
if
$dl_append = 1 then
$dl_append = 9
else
$dl_append = 10
endif
$my_log_file = FileOpen(
$log_file,
$dl_append)
FileWriteLine(
$my_log_file,
"corz " &
$my_name &
" log @ "&@YEAR&
"-"&@MON&
"-"&@MDAY&
".. " & @CRLF & _
"--------------------------------------------------------------------------------" & @CRLF & @CRLF)
if
$log_extra =
"" then FileWriteLine(
$my_log_file,
"command-line: " &
$CmdLineRaw)
FileWriteLine(
$my_log_file,
$log_extra)
FileWriteLine(
$my_log_file,
$log_string & @CRLF & @CRLF)
FileClose(
$my_log_file)
$log_string =
"" endif
else
$log_string &=
$dl_string & @CRLF
endif
endfunc
func TestFileWrite(
$tmpfile)
local
$t = FileWrite(
$tmpfile,
"")
if
$t = -1 then return false
return true
endfunc
func UpdateIniFile()
$old_version = IniRead(
$ini_path,
$my_name,
"version", 0)
if
$my_version <=
$old_version then return false
$tmp_ini = @TempDir &
"\ffe.ini.new" FileInstall(
".\stuff\ffe.ini",
$tmp_ini, 1)
$existing_sections = IniReadSectionNames(
$tmp_ini)
for
$a = 1 to
$existing_sections[0]
if
$existing_sections[
$a] <>
$my_name then
IniDelete(
$tmp_ini,
$existing_sections[
$a])
endif
next
$existing_sections = IniReadSectionNames(
$ini_path)
for
$a = 1 to
$existing_sections[0]
$section = IniReadSection(
$ini_path,
$existing_sections[
$a])
if IsArray(
$section) then
for
$b = 1 to
$section[0][0]
; we manually check for
if StringLeft(
$section[
$b][0], 1) <>
" then IniWrite(
$tmp_ini,
$existing_sections[
$a],
$section[
$b][0],
$section[
$b][1])
endif
next
endif
next
FileMove(
$ini_path, GetParent(
$ini_path) &
"\[" & @YEAR &
"-" & @MON &
"-" & @MDAY &
"@" & @hour &
"." & @min &
"] ffe.ini")
FileMove(
$tmp_ini,
$ini_path, 1)
IniWrite(
$ini_path,
$my_name,
"version",
$my_version)
endfunc
func DialogOpen()
GUISetState(@SW_DISABLE,
$ffeGUI)
UnSetHotKeys()
endfunc
func DialogClose()
GUISetState(@SW_ENABLE,
$ffeGUI)
SetHotKeys()
endfunc
func SetHotKeys()
HotKeySet(
"^f",
"HK_FindInOutput")
HotKeySet(
"{Esc}",
"HK_DoQuit")
HotKeySet(
"{TAB}",
"TabToCreateArgs")
if
$ffmpeg_loc then HotKeySet(
"{F1}",
"HK_DoIt")
endfunc
func UnSetHotKeys()
HotKeySet(
"^f")
HotKeySet(
"{Esc}")
HotKeySet(
"{TAB}")
HotKeySet(
"{F1}")
endfunc
func TabToCreateArgs()
HotKeySet(
"{TAB}")
Send(
"{TAB}")
HotKeySet(
"{TAB}",
"TabToCreateArgs")
if WinActive(
$my_title) then CreateArgs()
endfunc
func HK_DoIt()
if WinActive(
$my_title) then
DoIt()
else
HotKeySet(
"{F1}")
Send(
"{F1}")
HotKeySet(
"{F1}",
"HK_DoIt")
endif
endfunc
func HK_FindInOutput()
if WinActive(
$my_title) then
if GUICtrlRead(
$chk_console_output) =
$GUI_UNCHECKED then return
FindInOutput()
else
HotKeySet(
"^f")
Send(
"^f")
HotKeySet(
"^f",
"HK_FindInOutput")
endif
endfunc
func FindInOutput()
AutoItSetOption(
"GUIOnEventMode", 0)
_GUICtrlEdit_Find(
$edit_out)
AutoItSetOption(
"GUIOnEventMode", 1)
endfunc
func HK_DoQuit()
if WinActive(
$my_title) then
DoQuit(-9)
else
HotKeySet(
"{Esc}")
Send(
"{Esc}")
HotKeySet(
"{Esc}" ,
"HK_DoQuit")
endif
endfunc
func User_DoQuit()
DoQuit(-9)
endfunc
func DoQuit(
$ext=0)
SaveXYPrefs()
GUIDelete(
$ffeGUI)
if
$log_file = @TempDir &
"\ffe_tmp.log" then FileDelete(@TempDir &
"\ffe_tmp.log")
exit
$extendfunc