Jump to content

FavcDest


MilesAhead
 Share

Recommended Posts

I like to use FAVC video converter, but I don't like to use that Folder Pick thing built into

Windows to select the DVD Output Folder. I made this hack to change the output folder

setting, then launch FAVC.exe.

I had some time to kill today I guess :)

(Edit with hopefully debugged final version of script)

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 
 FavcDest - Makes it easier to select FAVC video converter destination folder
 Author:    MilesAhead
 Date:      2/Mar/2008

 Script Function:
    Compile this script and put a shortcut to it in the SendTo Folder
    so that you can right click a Folder for FAVC output.  Since FAVC
    has that Folder Picklist and doesn't allow any other method to
    choose the output folder other than manually editing the batch files,
    I made this hack to modify the FAVC Config.ini file before launching FAVC.
    
 Usage:
   Right click a Folder you wish to use as the destination for a FAVC
   video conversion and select FavcDest from the Send To list. On first
   run a FileOpenDialog lets you select FAVC.exe so that FavcDest may store
   its location in an .ini file.  Then it launches FAVC.exe with this
   Folder as the "Destination DVD Folder."
   
   Alternatively, if FavcDest.exe is in the path you can invoke it from
   the command line with the destination folder as param.

   (Unfortunately you still have to load the media and subtitle files manually.)

  Side-effects:
   The FAVC Config.ini file is overwritten on each run.  If it gets hosed,
   just delete it.  FAVC will create it again when you change settings.
   The location of the .ini file is FavcInstallFolder\Documents\Config.ini
   
   Creates an .ini file named FavcDest.ini in the folder where FavcDest.Exe
   is located.
   
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <File.au3>
Dim $fArray
$destDir = $CmdLine[1]
If Not FileExists($destDir) Then
    MsgBox(0,"FavcDest", $destDir & " Does Not Exist",4)
    Exit
EndIf

$favcFolder = "Unknown"
If Not _Init_Folder($favcFolder) Then
    MsgBox(0,"FavcDest", "Location of FAVC.exe Unknown",4)
    Exit
EndIf

$inFile = $favcFolder & "\Documents\Config.ini"

; used 2 filename vars to set a different output file during debugging
$outFile = $inFile

; first check if FAVC created Config.ini
If Not FileExists($inFile) Then
    MsgBox(0,"FavcDest", $inFile & " not found: run a FAVC conversion to create it")
    ShellExecute($favcFolder & "\FAVC.exe","",$favcFolder)
    Exit
EndIf

; FAVC will not use Config.ini if it finds an end-of-line on
; the last line of the file.  That's why the loop stops one line
; short and the last line is written without an end-of-line.

If _FileReadToArray($inFile, $fArray) Then
    $handle = FileOpen($outFile, 2)
    $fArray[1] = $destDir
    For $i = 1 to $fArray[0] - 1
        FileWriteLine($handle, $fArray[$i])
    Next
    FileWrite($handle, $fArray[$fArray[0]])
    FileClose($handle)
    ShellExecute($favcFolder & "\FAVC.exe","",$favcFolder)
EndIf

Func _Init_Folder(ByRef $favcInstallFolder)
    $iFile = @ScriptDir & "\FavcDest.ini"
    $fname = IniRead($iFile, "FavcFolder", "FAVC", "NotFound")
    If $fname <> "NotFound" Then
        $favcInstallFolder = $fname
        Return True
    EndIf
    $fname = FileOpenDialog("Select FAVC exe File", @ProgramFilesDir,"Executables (*.exe)",1 + 2,"FAVC.exe")
    If @error Then
        Return False
    EndIf
    IniWrite($iFile,"FavcFolder","FAVC", @WorkingDir)
    $favcInstallFolder = @WorkingDir
    Return True
EndFunc
Edited by MilesAhead
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...