global $my_version = "1.0.0.0" #cs.. ffe - an ffmpeg front-end, from corz.org. http://corz.org/windows/software/ffe/ http://www.google.com/search?q=ffmpeg About: ffe is a simple, yet powerful Windows® front-end for ffmpeg, designed for rapid testing of its various multimedia conversion parameters, enabling you to save lots of slightly different versions of a file very, very quickly; in other words, "find the best settings". ffmpeg, by Fabrice Bellard, et al., is a quite incredible multimedia converter, capable of converting a vast number of input and output media formats, and depending on which binary you use, supports either a HUGE number of control parameters, or a REALLY HUGE number of control parameters. ffe uniquely uses MATOF technology to automatically update output filenames to match your encoding parameters; you can tweak-and-go without worrying about obliterating your previous tests. While converting, the console output from ffmpeg can be viewed live inside ffe, and when complete, the entire process log is available for viewing/searching. More info here: http://corz.org/windows/software/ffe/ To use: Drop ffe.exe next to ffmpeg.exe (the ffmpeg binary). Run ffe.exe See inside ffe.ini file for some notes and tricks. 2do.. (maybe) add MATOF inside movie comments bugs.. ffe works great for my on my XP SP2 system. Reports of ffe working on other systems will be warmly received. Also reported to work well on Win2K and Vista. notes.. The program architecture; to use the term loosely; is fairly linear. As these things (gui's) go, one or two functions becomes three, and so on. On the bright side, it should be pretty clear how to hack in new stuff. if you are compiling this yourself, you need to use "AutoIt Wrapper" to add the extra icons. You will also need to use AT LEAST version 1.9.3 of AutoIt Wrapper for the paths to work correctly. You can download it here.. http://www.autoitscript.com/autoit3/scite/downloads.shtml NOTE: You need my "corz_essentials.au3" for this to work, if you didn't get this along with this source, go here.. http://corz.org/engine?section=windows%2FAutoIt%20Includes #ce #include #include #include #include #include #include "Include/corz_essentials.au3" 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 ; depending on your version of AutoIt, you might need to un/comment this next line.. ;const $WM_SYSCOMMAND = 0x0112 AutoItSetOption("GUIOnEventMode", 1) AutoItSetOption("TrayMenuMode", 9) AutoItSetOption("TrayOnEventMode", 1) AutoItSetOption("GUICoordMode", 1) ; NEVER AGAIN! ; init.. 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 ; must use text title definition here.. WinActivate($my_title) exit 5 endif ; enables you to see icons and such without compiling. ; requires your recent build to still be in-place, of course.. 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, $msgs global $installed_ini, $matof_string, $old_matof, $no_video, $no_audio, $launch_preset global $ffmpeg = 0, $find_count = 0, $switches, $go, $log_file, $log_string global $arTransItems[10] global $data_parent = @AppDataDir & "\corz\" & $my_name if not FileExists($data_parent) then DirCreate($data_parent) global $my_url = "http://corz.org/windows/software/" & $my_name & "/" global $folder_icon_index = -5 ; minimum window size.. global $min_width = 556 global $min_height = 480 $height_magic = 24 ; Magic! ; command-line parameters.. 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 ; process any special switches.. 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 ; one-time special portable install switch.. if $infile = "portable" then $installed_ini = FileInstall(".\stuff\ffe.ini", @ScriptDir & "\" & $ini_path) $infile = "" endif ; portable mode.. if FileExists($ini_path) then $portable = true $ini_path = @ScriptDir & "\" & $ini_path else ; regular AppData usage.. if not FileExists($data_parent) then DirCreate($data_parent) $ini_path = $data_parent & "\" & $ini_path $installed_ini = FileInstall(".\stuff\ffe.ini", $ini_path) endif ; update ini to latest version.. if not $installed_ini then UpdateIniFile() ; get ini values.. ; 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;*.wav;*.ogg;*.mp2;*.wma;*.asf;*.asx;*.ape;*.shn;*.mpc;*.flac)|Movie files(*.avi;*.mpg;*.mpeg;*.mov;*.mkv;*.ogm;*.mp4;*.asf;*.wmv;*.rm;*.flv)") 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") ; we need literal booleans here.. global $on_top = IniReadCheckBoxValue($ini_path, $my_name, "on_top", $GUI_UNCHECKED) global $user_trans = IniRead($ini_path, $my_name, "transparency", 0) ; a few checkboxes.. 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) ; MATOF! global $matof_status = IniReadCheckBoxValue($ini_path, $my_name, "matof_status", $GUI_CHECKED) ; use images on (some) buttons? global $image_buttons = IniRead($ini_path, $my_name, "image_buttons", "false") ; MATOF BUTTON INDEX! global $magic_butt = IniRead($ini_path, $my_name, "magic_butt", -6) global $matof_separator = IniRead($ini_path, $my_name, "matof_separator", " ") ; cuz above " " don't work, for some reason :/.. 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 = $i else $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 = $i if 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 ; handy measurements.. ; $half_width = $width/2 $column_two = $width/3 ; tray menu.. TrayCreateItem("About " & $my_name) TrayItemSetOnEvent(-1, "DoAboutBox") TrayCreateItem("") TrayCreateItem("Exit (Alt+F4 or Esc)") TrayItemSetOnEvent(-1, "User_DoQuit") ; system tray event.. ; left-click to show/hide the main window. 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") ; create the GUI.. ; $ffeGUI = GUICreate($my_title, $width, $height, $x, $y, _ BitOr($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP), $WS_EX_ACCEPTFILES) ; setup some GUI events.. ; 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") ; the application (system) menu.. ; built from the bottom, up.. ; $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) ; input file input.. ; $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)) ; output file input!.. ; $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)) ; the actual input area.. ; $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)) ;GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; magic auto-transforming output filename [MATOF!] .. ; 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") ; browse for output file.. ; 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)) ; input file parameter option things.. ; $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)) ; presets ; ; (aka. parameter favourites).. ; $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)) ; store the input/output file paths inside the preset? $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 ; output options.. ; $out_top = 66 $out_left = 10 $group_output = GUICtrlCreateGroup("output parameter override.. ", $out_left, $out_top+72, $width-20, 150) ;GUICtrlSetTip(-1, "click this text to reset all the values below..") GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKSIZE)) ;GUICtrlSetOnEvent(-1, "WipeSettings") ; video codec.. ; $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) ; video bitrate.. ; $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) ; video fps.. ; $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) ; cropping.. ; crop x .. ; $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)) ; video resizing.. ; x .. $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)) ; the "x" in 640x480! $resize_label = GUICtrlCreateLabel("x", $out_left+389, $out_top+108) GUICtrlSetResizing(-1, $GUI_DOCKALL) ; y .. $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)) ; preset sizes.. $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) ; resize-crop order.. $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) ; audio codec.. $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) ; audio bitrate $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) ; quick targets.. $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) ; extra raw parameters.. $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)) ; HELP! $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") ; reset all parameters.. $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") ; command-line input.. ; $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)) ; command-line output.. ; $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) ; append log output to previous log.. $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) ;search in output window.. $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) ; copy output to clipboard.. $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) ; clear the output.. $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) ; GO! 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 ; NO! $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) ; ; all done with creating the gui .. *phew* ToggleConsoleOutput() ToggleOnTop() ToggleOnTop() ToggleOverwite() ToggleOverwite() ; set initial transparency.. WinSetTrans($ffeGUI, "", 255 * (100 - $user_trans) / 100) ; Hot Keys.. SetHotKeys() ; show the main gui.. CheckSize() GUISetState() ; load either the default settings [ffe], or some specified preset.. LoadPreset($launch_preset) ; an input file was specified - fill the output file input.. if $infile then FillOutputFile() ; create the initial command-line arguments.. CreateArgs() ; Do it now? if $launch_preset and $go and $infile then DoIt() ; idle loop.. while 1 Sleep(333) wend ; fin! ; create the arguments for the command-line input. ; and MATOF extensions.. ; func CreateArgs() ; need to establish these for later checks.. $infile = GUICtrlRead($in_infile) $outfile = GUICtrlRead($in_outfile) $out_args = GUICtrlRead($in_raw_params) ; MATOF!!! ; we will build this string as we go.. $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 ; this over-rides everything.. 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 ; YES! DO IT! if $overwrite = $GUI_CHECKED then $out_args &= " -y " if GUICtrlRead($in_raw_params) <> "" then $matof_string &= "[" & GUICtrlRead($in_raw_params) & "]" endif ; ; MATOF!!! ; ; remove the old MATOF string from the output file name.. ; we don't want it removing, for instance; all space characters.. 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 ; default.. $clean_outfile_ext = GetExtension($clean_outfile) $clean_outfile_noext = RemoveExtension($clean_outfile) $clean_outfile_ext = GetExtFromCodec($read_vcodec) ; clean-up the output.. if $no_video then ;$matof_string = StringReplace($matof_string, "[-vn]", "") $matof_string = StringReplace($matof_string, "[" & $clean_outfile_ext & "]", "") endif ;if $no_audio then ; $matof_string = StringReplace($matof_string, "[-an]", "") ;endif ; MATOF has a new filename.. if $matof_string = "" then $separator = "" else $separator = $matof_separator endif $matof_outfile = $clean_outfile_noext & $separator & $matof_string & "." & $clean_outfile_ext ; grab the inserted part now.. it becomes the "previous matof", to be removed, later. $old_matof = $matof_string endif endif ; update the output file input.. GUICtrlSetData($in_outfile, $matof_outfile) ; the final argument.. $args = $ffmpeg_loc & " " & GUICtrlRead($in_input_params) & " -i " & """" & $infile & """" & $v_codec & _ " " & $a_codec & " " & $out_args & " " & """" & $matof_outfile & """" ; update the command-line input display.. GUICtrlSetData($edit_in_args, $args) endfunc ; add resizing parameters.. ; 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 " & $resize endfunc ; add cropping parameters.. ; 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 ; trim space or comma.. $matof_tmp_string = StringTrimRight($matof_tmp_string, 1) $matof_tmp_string &= "]" if $matof_tmp_string <> "[crop]" then $matof_string &= $matof_tmp_string endfunc ; check for correct extension (by codec).. ; 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 ; video is disabled.. 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_ext endfunc ; okay, here goes.. ; 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 ; wrapper func ComboLoadPreset() LoadPreset() endfunc ; load the settings from a saved preset ; brain-dead but logical.. ; 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 ; update the combo box with the current presets.. ; func UpdatePresets() $presets_string = "" $presets = IniReadSectionNames($ini_path) if not IsArray($presets) then return for $i = 0 to $presets[0]-1 ; only list the first occurence of each preset (you can have backups inside the ini - only the first is used) if not StringInStr($presets_string, $presets[$i+1]) then $presets_string &= $presets[$i+1] & "|" next ; now we just show it in the list regardless ;$presets_string = StringReplace($presets_string, "ffe|", "", 1) if StringRight($presets_string, 1) = "|" then $presets_string = StringTrimRight($presets_string, 1) GUICtrlSetData($combo_presets, "") GUICtrlSetData($combo_presets, $presets_string) endfunc ; save the current settings to a preset ; 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 ; delete the current preset from the ini file.. ; 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 ; clear all the paramater dials and switches back to their defaults.. ; 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) ; note GUICtrlSetSTATE! .. GUICtrlSetState($chk_resize_order, $GUI_UNCHECKED) GUICtrlSetData($in_raw_params, "") CreateArgs() endfunc ; some stuff that can happen in the output area.. ; 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 ; replace/add parameters from presets.. ; func TogglePresetMode() if GUICtrlRead($radio_preset_replace) = $GUI_CHECKED then ; add.. $replace_mode = $GUI_CHECKED else ; replace.. $replace_mode = $GUI_UNCHECKED endif IniWriteCheckBoxValue($ini_path, $my_name, "replace_mode", $replace_mode) endfunc ; enable/disable MATOF.. ; 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 ; toggle the console readout viewport.. ; 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 ; toggle the log append status.. ; 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 ; wrapper.. func MenuToggleOverwite() ToggleOverwite(false) endfunc ; toggle the overwrite flag ; 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 ; toggle the "always-on-top" status. ; 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 ; save the always-on-top status.. IniWriteCheckBoxValue($ini_path, $my_name, "on_top", $on_top) endif endfunc ; toggle the images on the buttons ; 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 ; drop a file on the input.. ; 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 ; a system tray item.. ; func ToggleWindow() $winstate = WinGetState($ffeGUI) if BitAnd($winstate, 2) then UnSetHotKeys() GUISetState(@SW_HIDE) else GUISetState(@SW_SHOW) SetHotKeys() endif endfunc ; browse for an input file.. ; 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 ; browse for an output file.. ; 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 ; Automatically fill the output field. ; if browsing manually (for an input file), it's no biggie to change ; it to whatever. If forgetting to input filnames, it's very handy.. ; func FillOutputFile() ; extension may be altered later, by codec prefs.. GUICtrlSetData($in_outfile, RemoveExtension(GUICtrlRead($in_infile)) & ".avi") endfunc ; application menu functions.. ; 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) ; 0xFFFFFFFF means "insert at the end" 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 $nID endfunc 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 ; set the window transparency (Windows 2000 or later) ; 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 = $nID endfunc ; in case the user needs to respond to an ffmpeg prompt.. 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 ; send an abort command to the running console application (ffmpeg) ; 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 ; save the user's transparency prefs.. ; func SaveOptTransparency() IniWrite($ini_path, $my_name, "transparency", $user_trans) endfunc func ResizeCheckSize() SaveXYPrefs() endfunc func PrimaryUpCheckSize() CheckSize() endfunc ; funky funky.. func CheckSize($save=true) $size_array = WinGetClientSize($ffeGUI) if not IsArray($size_array) then return 0 ; user window made too small for controls.. 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) ; fix off-desktop windows.. $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 & " ;o) ", 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; in other words, 'find the best settings'" & @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 ; ; DoLog() ; ; logs stuff.. ; ; the optional second parameter tells DoLog to append, or not. ; $dl_append will most likely receive the output from a checkbox.. ; 1 (append) or 4 [or anything else] (create new log) ; ; to stop and close the log, send "out" as your log string ; the optional third parameter '$log_extra' goes at top of log, ; and, if required, you must send it along with your "out" command, eg.. ; ; DoLog("out", 0, "command-line: " & $my_arguments & @CRLF & @CRLF) ; ; ; and now the function itself.. ; 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 ; update the user's existing ini with any new prefs.. ; func UpdateIniFile() $old_version = IniRead($ini_path, $my_name, "version", 0) if $my_version <= $old_version then return false ; drop a temporary ini file somewhere.. $tmp_ini = @TempDir & "\ffe.ini.new" FileInstall(".\stuff\ffe.ini", $tmp_ini, 1) ; delete all non-application prefs from the new (temp) ini ; basically, remove the sample batches.. $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 ; grab settings from user's old ini file.. ; $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 # comments, as AutoIt does not.. if StringLeft($section[$b][0], 1) <> "#" then IniWrite($tmp_ini, $existing_sections[$a], $section[$b][0], $section[$b][1]) endif next endif next ; rename their existing Batch Runner.ini to "[@date] Batch Runner.ini" FileMove($ini_path, GetParent($ini_path) & "\[" & @YEAR & "-" & @MON & "-" & @MDAY & "@" & @hour & "." & @min & "] ffe.ini") ; move the newly created ini into place, and delete temp file.. FileMove($tmp_ini, $ini_path, 1) ; finally, update the version info in the ini file.. 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 ; create the arguments afresh every time you use the key.. func TabToCreateArgs() HotKeySet("{TAB}") Send("{TAB}") HotKeySet("{TAB}","TabToCreateArgs") if WinActive($my_title) then CreateArgs() endfunc ; hit {F1} to start the encoding process.. func HK_DoIt() ; ffe is at the front.. if WinActive($my_title) then DoIt() else ; you are in some other application.. 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 ; find and select the user's query text.. func FindInOutput() AutoItSetOption("GUIOnEventMode", 0) _GUICtrlEdit_Find($edit_out) AutoItSetOption("GUIOnEventMode", 1) endfunc ; see ya! 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 ; bye! ; func DoQuit($ext=0) SaveXYPrefs() GUIDelete($ffeGUI) if $log_file = @TempDir & "\ffe_tmp.log" then FileDelete(@TempDir & "\ffe_tmp.log") exit $ext endfunc #cs version info here.. http://corz.org/machine/source/beta/windows/ffe/version.nfo #ce ; ; All done. Now the compiler directives.. ; #Region #AutoIt3Wrapper_Run_Obfuscator=y ; Note, no actual obfuscating! .. #Obfuscator_Parameters= /SF /SV /CV=0 /CF=0 /CS=0 /CN=0 /Beta ; Always wise.. #AutoIt3Wrapper_Run_AU3Check = y ; AutoIt3Wrapper settings.. #AutoIt3Wrapper_Icon = icons\ffe.ico #AutoIt3Wrapper_Res_Icon_Add = icons\document-outline.ico #AutoIt3Wrapper_Res_Icon_Add = icons\magic-wand.ico #AutoIt3Wrapper_Res_Icon_Add = icons\document-small.ico #AutoIt3Wrapper_Res_Icon_Add = icons\folder-small.ico #AutoIt3Wrapper_Res_Icon_Add = icons\folder-small-outline.ico ; free-form resource fields (max 15).. #AutoIt3Wrapper_Res_Field = Author|(or #AutoIt3Wrapper_Res_Field = Compiled|%date% - %time% #AutoIt3Wrapper_Res_Field = URL|http://corz.org/windows/software/ffe/ ; resource info.. #AutoIt3Wrapper_Res_Comment = ffe #AutoIt3Wrapper_Res_Description = corz ffmpeg front-end for windows #AutoIt3Wrapper_Res_LegalCopyright = (or at corz.org 2007 -> #AutoIt3Wrapper_Res_Fileversion = 1.0.0.0 #EndRegion #cs command-line tests.. "P:\arc_in\YouTube Videos\skc ~ welcome.flv" load(FLV to AVI) load(ffe backup mp4) load(ffe backup mp4) "P:\arc_in\YouTube Videos\skc ~ welcome.flv" load(FLV to AVI) "P:\arc_in\YouTube Videos\skc ~ welcome.flv" go(ffe backup mp4) go "P:\arc_in\YouTube Videos\skc ~ welcome.flv" [this should NOT go!] go(ffe) "P:\arc_in\YouTube Videos\skc ~ welcome.flv" go(ffe backup mp4) "P:\arc_in\YouTube Videos\skc ~ welcome.flv" go(FLV to AVI) "P:\arc_in\YouTube Videos\skc ~ welcome.flv" go(ffe) "P:\arc_in\YouTube Videos\skc ~ welcome.flv" #ce