FAR Batch Mode

Introduction | Script Example | .FarRun batch files | Batch Mode Tips
Command-Line Switches | Script Commands

Some FAR functionality can be run from a script file. Great for overnight builds. Great for performing repeated daily tasks.  If you give your FAR batch script file the special file extension .FarRun, then you can run this file under Windows and it will automatically start FAR and perform the batch operation for you without having to bother with special FAR.exe command-line parameters.

Getting started

A good place to start with batch work is to walk through some real world examples.

 

Introduction

To automate FAR either:

  1. pass a script file (any .ext file extention) to FAR via the command-line, or
  2. give the script file a .FarRun file extension and run that. There is a file association with .FarBat and FAR.EXE.
    .FarRun files must simply contain a extra section called [default] with a list of sections to run.
Command-line Switches

These switches can be used on the command line, or in the [default] section of a .FarRun file.

FAR Command Script + Tasks

The following script commands are available:

    Command Description     Command Script
1. Execute File Command !, @
2. Filling the File List OpenFarList=, OpenFarSrch=, DirScan=, Dir=, FileScan=, File=
3. Drop File Filter Commands Drop_Options=
4. Find and Replace Command ** FindStart=, Replace=
5. HTML Help Commands ** MakeHHC=, MakeHxT=, MakeHxK=, MakeHHK=, MakeHHP=, ExportNav= ##
6. Link Check CHM Command LinkCheckChm=
7. Help Batch Compile Command BatchCompile=
8. Copy/Backup Command ** CopyTo= or BackupTo=
9. FTP Copy Command ** FtpCopyTo=
10. Build JS Search Data File Command ** JSSearch=
11. Make Uncompressed Help MakeUncompHelp=
12. TOC or Index File Merge BatchMergeFile=
13. Encode Files Command ** Encode=

Commands

The first command can be used to get FAR to run another application.
The next 2 commands are used to fill the FAR file list. A file list is required by those commands marked with a **.
## ExportNav= command does not required a file list either.

1 Task per INI Section

Each INI file section should contain a single FAR task. A task may contain 0 or 1 file list commands + 1x regular command.
EG. Load a file list + perform an FTP upload.

[FTP_Upload_Srch]
OpenFarSrch=ftp_help.FAR
FtpCopyTo=WebSiteB Upload
FtpCopyTo_TraceOn=N
FtpCopyTo_TransferMode=Auto

A script file can contain one or many sections. You can spread sections across many files and run them all from the one file.

 

FAR Script Logic

What would happen if I placed 2 tasks in the one section? Firstly this is not recommended.
The following code describes the FAR Batch Mode logic when reading an ini file section.

If Link Check Chm command specified then
   Do Link Checking of LinkCheckChm= file
else if Batch Compile command specified then
   Do Compile all help projects listed in the file BatchCompile=
else if FAR File List has items then
begin 
   if FindStart= specified then
     Do Find And Replace
   else
     Do Other File List type commands
end

 

Script Example

In this example we will use the FtpCopyTo= command to upload files in the FAR file list.
The two batch jobs actually do similar work. The first (FTP_Upload_List) uses OpenFarList= to open an explicit file list.
The second (FTP_Upload_Srch) uses OpenFarSrch= command to fill the FAR file list by scanning the folder specified in ftp_help.FAR.

<file: BatchJob.ini>
; Run 2 sections below
[default]
FTP_Upload_List
FTP_Upload_Srch

; Upload the files listed in ftp_help.FAR
[FTP_Upload_List]
OpenFarList=ftp_help.FAR
FtpCopyTo=WebSiteB Upload
FtpCopyTo_TraceOn=N
FtpCopyTo_TransferMode=Auto

; Upload the files found using the search filter and base dir in ftp_help.FAR
[FTP_Upload_Srch]
OpenFarSrch=ftp_help.FAR
FtpCopyTo=WebSiteB Upload
FtpCopyTo_TraceOn=N
FtpCopyTo_TransferMode=Auto

Preparation

First create a .FAR file list file using the File > Save File List menu command.
A .FAR file list is an INI file containing both an explicit file list and the current Drop Filter & Base Directory.

OpenFarList=ftp_help.FAR  -- This command explicitly loads the list of files from the .FAR file.

OpenFarSrch=ftp_help.FAR -- This command searches for files matching the Filter and Base Dir stored in the .FAR file.

Command Sections

[FTP_Upload_List] -- This batch command (task) loads the explicit file list from the ftp_help.FAR file. It performs a FtpCopy= command and uploads the file list using the "WebSiteB Upload" FTP profile (set this up previously using the FTP Copy dialog).

[FTP_Upload_Srch] -- Same except this time FAR builds a file list using the ftp_help.FAR's Drop Filter & Base Directory.

[Default] -- Contains a lists of batch commands. This can be any name if running from the command line, however the [default] name is required if you use a .FarRun file extension. When you double-click the .FarRun file, FAR runs the [default] section.

 

Running script from the command-line

To run batch command [FTP_Upload_List] in file BatchJob.ini above:

FAR.EXE /B:BatchJob.ini,FTP_Upload_List

Notice the INI file has a relative path. We actually created a shortcut to FAR.exe in the same folder as INI file. Make the shortcut property "Start In" director = the location of the INI file. If you used a batch (.BAT) file you would first do a CD (ChangeDir) to the INI file directory.


This one runs both the [FTP_Upload_List] and [FTP_Upload_Srch] commands. The full path to the INI file is used so the Current Directory is of no concern. The INI file path contains spaces so we need to wrap each batch command in quotes.

FAR.EXE "/B:c:\program files\jobs\BatchJob.ini,FTP_Upload_List"  "/B:c:\program files\jobs\BatchJob.ini,FTP_Upload_Srch"


The command-line is getting a bit long. We can use the /BB command to run a list of batch commands (batch of batches).
Look back at the BatchJob.ini file above. Section [default] lists both the [FTP_Upload_List] and [FTP_Upload_Srch] batch commands.

FAR.EXE "/BB:c:\program files\jobs\BatchJob.ini,default" /L:MyLog.txt

So now we can run several batch commands from a single command-line statement. Notice we have also set the Log file name using the /L switch.
 

Running script from a .FarRun batch file

Give your script files a .FarRun file extension to enable them to run like a .BAT file runs. 

When you double-click on "SomeFile.FarRun" in Explorer, Windows will pass that script file to FAR.exe, which then executes the script in the [default] section of the file. The [default] section is the file's master batch list (defines a batch of batches).

You can also run/open .FarRun files from the command line like this:

FAR.exe /O "c:\path\BatchJob.farrun"

Here's how we make the above example into a .FarRun file.

  1. Rename <file: BatchJob.ini> to <file: BatchJob.farrun>
  2. Add a section [default] containing batch commands + required switches.
    Notice that the batch commands don't require the /B switch anymore.

If you have a choice between .ini and .farrun, use the newer .farrun since it can be run both ways (with a FAR /B command line parameter, or run standalone).

<file: BatchJob.farrun>

[default]
; set the log file name
/L:c:\path\MyLogfile.txt
; set the debug switch to not close FAR at the end
/D:1
; Specify code pages for FAR to use
/CP:65001
; Run 2 batch commands (/b switches not required)
FTP_Upload_List
FTP_Upload_Srch

; Upload the files listed in ftp_help.FAR
[FTP_Upload_List]
OpenFarList=ftp_help.FAR
FtpCopyTo=WebSiteB Upload
FtpCopyTo_TraceOn=N
FtpCopyTo_TransferMode=Auto

; Upload the files found using the search filter in ftp_help.FAR
[FTP_Upload_Srch]
OpenFarSrch=ftp_help.FAR
FtpCopyTo=WebSiteB Upload
FtpCopyTo_TraceOn=N
FtpCopyTo_TransferMode=Auto

That's it. Run BatchJob.farrun (double-click in explorer, run from a batch file, whatever) and the 2 batch jobs will fire one after another. The log file will show at the end of the run.

Note: With .FarRun file you don't have to worry about the current directory. This is always set to the directory containing the .FarRun script file.

 

A Master Batch File that Runs Other Batch Files

You can spread batch commands over several files and run all batch commands from a single file.

Example: I have 3 files (xxx.farrun, yyy.farrun, zzz.ini) each contains 2 batch command sections [ScanFiles] and [BatchCopy] (they all just happen to contain the same command section names). If I wanted to run all 3 batch files (all 6 commands) I could cut and paste all command sections into a single batch file. However this would be tricky since all 3 files use the same command names, so we would need to carefully rename each section to keep section names unique. The best solution would be to create a 4th file that could executed all 6 commands in all 3 files.

Here is a file I'll call "Master.FarRun". Note that all batch files are located in the same folder so paths are not required. If they were in different folders I would need to specify a full file path to each batch file. Each line contains the file and batch job in that file to run.

[default]
xxx.farrun,ScanFiles
xxx.farrun,BatchCopy
yyy.farrun,ScanFiles
yyy.farrun,BatchCopy
zzz.ini,ScanFiles
zzz.ini,BatchCopy
 

18-Oct-2008: You can now run the [default] section (batch of batch jobs) in other files.

This example runs the [default] section of the file xx.farrun. So effectively all batch jobs in xxx.farrun that are listed under its [default] section.

[default]
xxx.farrun,default

You can also achieve the same thing by dropping the ',default' part. The final log will still however show that ',default' was used.

[default]
xxx.farrun
 

Batch Mode Tips

There is an example batch file "FarBatch.ini" in the FAR.exe install directory that you can modify and try out

FAR /b:FARBatch.ini,DEMO_BATCH1
FAR /bb:FARBatch.ini,batchList

  1. Where file names are specified, the filename can be either a fully qualified file name or a file name relative to the current directory.
     
  2. If your command line parameters contain space characters, you must wrap the parameter in double quotes.
    This rule applies to running via a command line only. Quotes are not required when running a .FarRun file.
    EG. FAR "/b:c:\program files\batch.ini,Job" "/L:c:\my documents\BatchRun.log"
     
  3. An easy way to run a batch job (batch INI file), is to drag a shortcut of FAR.EXE into the folder containing the batch command INI file. Right-click the shortcut, select "properties", and add the batch command-line after the far.exe file name. If you do not specify the full path to the INI file, then also set the Shortcut's "Start In" folder as well. Double-click the shortcut and you are away.
     
Command-Line Switches

The following special Batch Mode command line switches are available.

/L - Log file options
/D - Debug options
/CP - Select a windows CodePage
/B - Run a Batch
/BB - Run Batch of Batches

Note: /B and /BB are not required if run as .FarRun command file.
 

/L:logfile,n

Use the /L: switch to override the default log file behavior.
Note: In a .FarBat file you can insert this command directly into the top of the [default] section.

/L:filename.log

Uses log file name filename.log (or some other name) instead of _BatchLog.txt (the default).

/L:filename.log,1

1 = Clear old log file contents before use. Default is to append to the end of the existing log.

/L:filename.log,2

2 = Don't automatically open log file at end of Batch Mode run.

/L:filename.log,3

3 = Combination of 1 + 2 above.

"/L:c:\program files\path\filename.log,3"

Uses full path to the log file. Command-line is wrapped in quotes since the path contains a space. Quotes are not required in a .FarRun file.

Verbose or Brief logging - [8-June-2012]

Example: /L:filename.log,3,brief

Append the word "brief" to enable brief logging.

This will stop files that have not been modified from being reported.


Log Notes

_BatchLog.txt is normally created in the same folder as the INI command file. If this folder is read-only then the file would be created in the Windows Temp\~far folder.

Note: In Windows XP the c:\Program Files\ area is now read-only access unless you are logged on as an administrator.


Reading the Log file

Any log lines containing two or three asterisks should be checked:
**      = Warning message. May or may not be a problem.
***    = Error message. An error will normally terminates the batch run.

 

/D:1 /D:2 /D:4

Cmd line debug switches can be used when you are testing and debugging your scripts.
Note: In a .FarBat file you can insert this command directly into the top of the [default] section.

/d:1

Don't close FAR at end of Batch processing.
Normally FAR is closed at the completion of batch processing.

/d:2

Turn Replace mode OFF for find and replace command.
Works in non-destructive Find Only mode.

/d:4

Turn prompt mode ON for find and replace command.
Normally you don't get prompted for "Change xx to yyy (Y/N)" in batch mode.
Prompt mode ON will show you what will be replaced with what, and ask Replace Y/N.

NOTE: You can combine switches together.
EG. /d:5 would be equivalent to /d:1 and /d:4 combined.

 

/CP:n

Specify a Code Page for FAR to use.
Note: In a .FarBat file you can insert this command directly into the top of the [default] section.

Remember that the English character set is included in all ANSI code pages.

/cp:n

n is an integer representing a valid code page.
eg. /cp:65001  -- 65001 is the code page for UTF-8 (see comments below)

Example: In a .FarBat file set the codePage used for all batch jobs in the file (932 is Japanese codepage).

[default]
/cp:932
MyBatchJob

[MyBatchJob]
...

CodePage= command

You can also specify a code page for an individual batch job. Here is an example (932 is Japanese codepage) is used instead for the batch job [MyBatchJob] instead of the global codepage 666:

[default]
/cp:666
MyBatchJob

[MyBatchJob]
CodePage=932
drop_options=SpecialFiler1
dirscan=D:\UVHelp\Test
FindStart='<Font '
Replace=''

How do I find a valid code page?
 
Open the "Commands > Set File Encoding" dialog. The language dialog display a list of languages and their code page numbers.
 
How does FAR handle code pages under batch mode?

When FAR opens a ANSI file it uses the current Code Page as specified in "Control Panel > Region and Language Options". If that fails then the Code Page specified in the /cp:n command line parameter is used. If that fails it will try using the CodePage= ini file parameter. If all fails you will see a Code Page error in the batch log.
 
 
/B:filename.ini,SectionName

/B:filename.ini,SectionName

Opens filename.ini and reads the ini section [SectionName].
Once all settings are read FAR performs the specified task.
The FAR command line may specify more than one batch job.
EG.  FAR   /b:file1,Section1   /b:file1,Section2    /b:file2,Section1
Alternatively you can place several batch jobs into a master file and use the /bb:xx,xx switch.

Note: In a .FarRun file you simply specify all the SectionName's you want to run in its [default] section.

[default]
SectionName1
SectionName2
...

See /BB Switch below

 

/BB:filename.ini,BatchSection

Opens filename.ini and processes all batch jobs specified in in section [BATCHSECTION] (name is example only).
Also called a "Batch of batch jobs".

Example: /bb:MyBatchFile.ini,MyBatchList

Where MyBatchFile.ini contains

[MyBatchList]
MyBatchFile.ini,StripCodes
MyBatchFile.ini,ReplaceSig
MyBatchFile.ini,ReplaceCorpEmail
etc...

[StripCodes]
...stuff...

[ReplaceSig]
...stuff...

[ReplaceCorpEmail]
...stuff...

Note: Each line in [MyBatchList] acts like a /b command switch.
For example both these commands are equivalent:

2-Dec-2003:

The Batch of batch jobs no longer requires you to specify the target INI file name if the target is the current file.
Example: The following works for the above example.

[MyBatchList]
StripCodes
ReplaceSig
ReplaceCorpEmail

.FarRun Batch file

Note: In a .FarRun file you simply specify all the SectionName's you want to run in its [default] section. So in a .FarRun file the default section actually replaces the need for the /bb switch.

[default]
SectionName1
SectionName2
...

 


Batch INI Script Commands

The following are commands you can use in a FAR Batch INI file.

    Command Description     Command Script
1. Execute File Command !, @
2. Filling the File List OpenFarList=, OpenFarSrch=, DirScan=, Dir=, FileScan=, File=
3. Drop File Filter Commands Drop_Options=
4. Find and Replace Command ** FindStart=, Replace=
5. HTML Help Commands ** MakeHHC=, MakeHxT=, MakeHxK=, MakeHHK=, MakeHHP=, ExportNav=
6. Link Check CHM Command LinkCheckChm=
7. Help Batch Compile Command BatchCompile=
8. Copy/Backup Command ** CopyTo= or BackupTo=
9. FTP Copy Command ** FtpCopyTo=
10. Build JS Search Data File Command ** JSSearch=
11. Make Uncompressed Help MakeUncompHelp=
12. TOC or Index File Merge BatchMergeFile=

Commands

The first command can be used to get FAR to run another application.
The next 2 commands are used to fill the FAR file list. A file list is required by those commands marked with a **
(except ExportNav= which does not need a file list).

 

Execute File commands - 26-Feb-1999

[MyBatchList]
!d:\myjobs.bat,
@d:\somefile.exe,params

Use the above form to execute files from within a multi-batch job.
Any file type will work: exe, bat, com, txt, etc.

You can mix FAR batch jobs with Execs.

Example INI file

-- FarBatch.ini

[OverNightRun]
d:\batchtest\FARBatch.ini,SearchAndReplace001
!d:\test.bat
@c:\MyProg.exe, /m

Example of executing a file

FAR.EXE /bb:d:\BatchTest\FarBatch.ini,OverNightRun

This runs the multi-batch INI section [OverNightRun] in FarBatch.ini. [OverNightRun] specifies 3 commands. The first runs the command(s) found in section [SearchAndReplace001]. Next test.bat is run (without waiting), then c:\MyProg.exe is run with a command line "/m". FAR waits for c:\MyProg.exe to complete before processing any further commands of closing itself.

.FarRun File

In a .FarRun file you would add the Execute File commands to the [default] section of the .FarRun file.

[default]
!d:\test.bat
@c:\MyProg.exe, /m
SectionName1
SectionName2
...

 


Filling the File List

OpenFarList=, OpenFarSrch=, DirScan=, Dir=, FileScan=, File=
ClearFileList=


Most FAR Batch commands such as Find & Replace, MakeHHC, CopyTo etc require a list of files. To fill the FAR file list use either:


OpenFarList=, OpenFarSrch=

These 2 commands are the easiest way to fill the FAR file list.

In FAR you can save your current FAR file list, drop filter and base folder to a .FAR file using the "File > Save" command. FAR actually saves both (a) the explicit list of files and (b) the current drop filter and base folder.

Here (below) is an example .FAR file. Notice the explicit list in the [FILES] section, and the search filter in the [FILTER] section?

When you do a "File > Open" (FAR main window) you can choose to load either the explicit list OR search for the files using the retrieved base folder and filter (the choice is made using the checkbox at the bottom of the FAR File Open dialog). Thus loading a .FAR file is an easier way to setup the BaseDir, Filter and Filelist.

[BASE_DIR]
base=D:\Proj\vss\FAR\help

[FILTER]
_opSkipDirs=1
_opSkipFiles=1
_opIncFiles=1
_opSkipDirsSL=_vti*|1|_private|1|
_opSkipFilesSL=.hxs|1|.chm|1|
_opIncFilesSL=.htm|1|.html|1|

[FILES]
D:\Proj\vss\FAR\help\authoring_menu.htm
D:\Proj\vss\FAR\help\changenotes.htm
D:\Proj\vss\FAR\help\collections.htm
D:\Proj\vss\FAR\help\command_menu.htm
...

OpenFarList=D:\UVHelp\Test\mylist.far
OpenFarList=mylist.far

Loads the list of files found in the specified .FAR file. Use an absolute or relative file path.

7-Feb-2007: Note that you can now also specify a .HHP or .HxC file.
This loads the file list defined by the specified help project file. HHP is a HTML Help project file. HxC is a MS Help 2.x help project file.

OpenFarSrch=D:\UVHelp\Test\mylist.far
OpenFarSrch=mylist.far

Search for and load files by using the drop filter and base folder specified in the .FAR file. Use an absolute or relative file path.


DirScan=, Dir=

These 2 commands must be used with the DROP_OPTIONS= command (see below).

DirScan=D:\UVHelp\Test

Clears the FAR file list then fills it with all files found in the specified folder.
This command is Recursive - it will find files in all subfolders.
Note1: Exclude or set blank to use current list (file list not cleared).
Note2: Set to "." (no quotes) to use the folder where the INI file resides (12-Jun-2001).

Must use this command with a DROP_OPTIONS= section (see below).

Dir=D:\UVHelp\Test

This command is exactly the same as DirScan= (above) except it is Not Recursive.

Must use this command with a DROP_OPTIONS= section (see below).


FileScan=, File=

These 2 commands don't require a drop file filter. You simply provide a DOS type file spec. Use an absolute or relative file path. The paths can optionally contain * or ? wild chars.

FileScan=D:\UVHelp\Test\sp*.htm*
FileScan=file.htm

Clears the FAR file list then fills it with all files found using the specified file spec.
This command is Recursive - it will find files in all subfolders.

File=D:\UVHelp\Test\sp*.htm*
File=*.ht*

This command is exactly the same as FileScan= (above) except it is Not Recursive.


New: 13-Feb-2014

ClearFileList=

This command can be used with any of the list filling commands above.
By default we always clear the file list before filling. ie. ClearFileList=y
Set =no to inhibit the clearing of the file list before one of the above fill commands.

ClearFileList=n

If set to n, no, N, No or 0 the file list is not cleared before filling.

 


Drop File Filter Commands

DROP_OPTIONS=

Use the DROP_OPTIONS command to setup a drop file filter for the DIRSCAN and DIR commands (above).

Specify where to find filter settings.
Command parameter XXX (of DROP_OPTIONS=XXX) points to another INI section in the same file containing the file filter settings. The filter settings relate directly to the settings in the FAR Drop File Filters dialog.
Each file found must pass though all 3 filters (if enabled) before allowed into the main FAR file list.
A filter section can be shared by several batch jobs or you can define a filter section for each and every batch job.

Note: If you exclude DROP_OPTIONS= or do not set a parameter FAR will use the current FAR filter.

 

Example:

[MyBatchJob]
drop_options=SpecialFiler1
dirscan=D:\UVHelp\Test

[SpecialFiler1]
_opSkipDirs=1
_opSkipFiles=0
_opIncFiles=1
_opSkipDirsSL=_vti*|1|_private|0|_*|0|
_opSkipFilesSL=.zip|1|.exe|1|.com|1|.dll|0|.bak|1|.~*|0|.toc|1|.hhp|0|.chm|0|.hhk|0|.hhc|0|
_opIncFilesSL=.ht*|1|.jpg|0|.gif|0|.txt|0|.swf|0|.cab|0|

Description:

So looking at the above example we see that the batch job section contains "drop_options=SpecialFiler1". This indicates that the section [SpecialFiler1] defines the batch jobs drop filter settings.

_opSkipDirs=1 is an overall switch for the _opSkipDirsSL line. It says _opSkipDirsSL settings are enabled.
_opSkipFiles=0 is an overall switch for the _opSkipFilesSL line. It says _opSkipFilesSL settings are disabled.
_opIncFiles=1 is an overall switch for the _opIncFilesSL line. It says _opIncFilesSL settings are enabled.

Thus deleting the line _opSkipFilesSL=.zip|1|... would make no difference since _opSkipFiles=0.

Look at line _opSkipDirsSL=_vti*|1|_private|0|_*|0|
Parameters are in pairs. The _vti|1| parameter pair indicates that the "_vti*" entry is enabled (active).  _private|0| means that "_private" entry is declared but not in use (inactive). If you study the Drop File Filters dialog in FAR you get a better understanding of how the filter information is used.

Note: If you open the registry editor you will see that FAR saves its settings in the same format:
(See HKEY_CURRENT_USER\Software\The Helpware Group\FAR\Settings\Filter_blabla)

 


Find and Replace Command

FindStart=, FindEnd= ...

To fill the file list for a file related command use either: DIRSCAN=, DIR=, DROP_OPTIONS=, OpenFarList=, OpenFarSrch=

Important: A Batch command can only contain one FindStart= command. Use the /BB switch to run multiple commands, or create a .FarRun file with a [DEFAULT] section.

4/7/2008 Note: There is no longer a need to script Find and Replace jobs by hand. Go to the Advanced Search dialog and select File > Save to save the search settings as batch script. You will still however need to code the loading of the FAR file list (eg. DirScan=) and any required drop_options.

Example: FAR /b:MyBatchFile.ini,MyBatchJob

Where MyBatchFile.ini contains 2 sections.

[MyBatchJob]
drop_options=SpecialFiler1
dirscan=D:\UVHelp\Test
FindStart='<Font '
Replace=''

[SpecialFiler1]
_opSkipDirs=1
_opSkipFiles=0
_opIncFiles=1
_opSkipDirsSL=_vti*|1|_private|0|_*|0|
_opSkipFilesSL=.zip|1|.exe|1|.com|1|.dll|0|.bak|1|.~*|0|.toc|1|.hhp|0|.chm|0|.hhk|0|.hhc|0|
_opIncFilesSL=.ht*|1|.jpg|0|.gif|0|.txt|0|.swf|0|.cab|0|

This command recursively finds all Web type files (see filter) then replace all occurrence of text "<Font " with an empty string. Bad example but you get the idea.

FindStart='<Font '
Replace=''

Find and Replace strings. FindStart= must contain something.

Replace= is optional. It may be empty to replace with an empty string. If not found then a search without replace is performed.

You can embed Carriage Return / Linefeed character pairs into strings using the code $#13$$#10$. You can also extend the Replace= text over multiple lines by using a \ (or /) char on character 1, followed by a single space character in subsequent lines. For example:

replace= 'this is line 1'
\ 'This is line 2'
\ This is line 3
\ "This is line 4

Is the same as:
   this is line 1
   This is line 2
   This is line 3
   "This is line 4

Note the single quote appears since it did not have a matching terminating quote. Surrounding quotes are optional.

FindEnd='>'  (optional)

Exclude or set blank to ignore this and do the regular find and replace.
EG. FindStart = '<font ' and FindEnd = '>'. FAR will find all strings in the form "<font xxx>" and replace them with the Replace= string.

IgnoreCase=  (optional)

Default=Y
Case sensitive search.
Exclude or set blank for the default of IgnoreCase=Y
Valid settings are - yes / no / y / n / YES / NO / Y / N
EG. FindStart=xyz will match XyZ, xyz, XYZ etc if IgnoreCase=Y
EG. FindStart=xyz will only match xyz if IgnoreCase=N

DosUnix=  (optional)

Default=N
When searching for a match, DOS "\" and UNIX "/" path separators are treated the same.
Exclude or set blank for the default of DosUnix=N
Valid settings are - yes / no / y / n / YES / NO / Y / N
Tip: Useful with HTML files to match DOS or UNIX type paths.

IgnoreMultiSpace=  (optional)

Default=Y
When searching for a match a string of spaces is treated as one single space.
Exclude or set blank for the default of IgnoreMultiSpace=Y
Valid settings are - yes / no / y / n / YES / NO / Y / N
Tip: Useful with HTML files where some editors insert extra spaces.

IgnoreCRLF=  (optional)

Default=Y
When searching for a match ignore CR and LF characters. Treat them as a single space char.
Exclude or set blank for the default of IgnoreCRLF=Y
Valid settings are - yes / no / y / n / YES / NO / Y / N
Tip: Useful with HTML files to overcome the problem of lines being broken at any space character.

Other Command

These are mostly new specialized commands. Not commonly used.

FindFirstOnly=N  (optional)

Default=N
When searching for a match find only the first occurrence in each file.
Valid settings are - yes / no / y / n / YES / NO / Y / N
Tip: Useful when scanning quickly for any occurrence of a string in a each file.

MatchStartOnly=N (optional)

Default=N
When searching for a match, only match the starting characters of each file. ie. Ignore matches deeper in each file.
Valid settings are - yes / no / y / n / YES / NO / Y / N
Note: This wont speed up file loading time since FAR mostly works with text files and loads each file completely into memory before scanning for text.

IncMatches=N (optional) -- [Build 768]

Default=N
Normally before we start a Search of all files we clear the Matches column.
Set =Y to not clear each items match value, Instead each match will just keep incrementing for each hit (with multiple search passes).
Example: Load a list. Search for "BugLevel1"; Search for "BugLevel2"; Now you have files marked that contain both these strings and can now Copy all match files (see CopyTo= command).
Valid settings are - yes / no / y / n / YES / NO / Y / N

KeepFileDateTime=N (optional) -- [Build 775]

Default=N
Normally as files are modified they get stamped with the current date & time.
Set =Y to keep the same date and time.
Valid settings are - yes / no / y / n / YES / NO / Y / N

 

Other Find and Replace Commands

New: 31-Dec-2000

All the other settings  in the "Advanced Search" and "Define Substring $n$" dialogs are now available. Below is a list all available Advanced Search settings.  Yellow highlighted items are the new ones. See the Advanced Search dialog help for more help.

INI Identifier Type Default Value
IgnoreCase=
IgnoreCRLF=
IgnoreMultiSpace=
DosUnix=
FindFirstOnly=
MatchStartOnly=
y/n
y/n
y/n
y/n
y/n
y/n
y
y
y
y
n
n
FindStart=
FindEnd=
FindContains=
FindNotContains=
Replace=
text
text
text
text
text
''
''
''
"
"
FindEnd.Checked=
FindContains.Checked=
FindNotContains.Checked=
Replace.Checked=
y/n
y/n
y/n
y/n
y (if FindEnd set to something)
y (if FindContains set something)
y (if FindNotContains set something)
y (if Replace defined)
RelativePath= text ''
Substrings: Replace $n$ with either $A$, $B$ or $C$
$n$.FindSubStrNo=
$n$.ContainingText=
$n$.NotContainingText=
$n$.StartText=
$n$.EndText=
$n$.IncStartEndText=
$n$.StartDeleteThisText=
$n$.EndDeleteThisText=
$n$.ReplaceDelTextWith=
$n$.DeleteTextMode=
$n$.UseOrig=

where $n$.DeleteTextMode=
  0 = Normal
  1 = Between Text (new: 3-Feb-2003)
  2 = Up to Text
  3 = Up to and Inc text
  4 = After text
  5 = After and Inc text
  6 = Normal, but replace all occurrences.

1..999
text
text
text
text
y/n
text
text
text
0..6
y/n
1
''
''
'"'
'"'
n
''
''
''
0
n

Note: FAR only logs the $A$ settings above if a '$A$' string is found in the replacement string. Same goes for $B$ and $C$.

Example INI file 

In this trivial example $A$ string is replaced with the find string '<p>'.  So the final result is every occurrence of '<p>' is replaced with '<br><p>'.

-- File: FARBatch.ini

[MyDoCleanUp]
Drop_Options=FILTER_HTM
DIRSCAN=d:\temp\helpme1
FindStart='<p>'
Replace='<br>$A$'
$A$.FindSubStrNo=1
$A$.ContainingText=
$A$.NotContainingText=
$A$.StartText=<
$A$.EndText=>
$A$.IncStartEndText=y


[FILTER_HTM]
_opSkipDirs=1
_opSkipFiles=0
_opIncFiles=1
_opSkipDirsSL=_vti*|1|_private|1|
_opSkipFilesSL=.zip|0|.exe|0|.com|0|.dll|0|.bak|0|.~*|0|.toc|0|.hhp|0|.chm|0
|.hhk|0|.hhc|0|
_opIncFilesSL=.ht*|1|.jpg|0|.gif|0|.txt|1|.swf|0|.cab|0|.hhc|0|.hhk|0|


; For Multi Batch job...
[MyMultiBatchJob]
FARBatch.ini,MyDoCleanUp
FARBatch.ini,AnotherSection1
FARBatch.ini,AnotherSection2

Example of running the above as a FAR batch job (/b command)

FAR.EXE /b:d:\batchtest\FarBatch.ini,MyDoCleanUp

This runs the Find and Replace job specified in section [MyDoCleanUp].

Example of running the above as a FAR "batch of batches" job (/bb command)

FAR.EXE /bb:d:\batchtest\FarBatch.ini,MyMultiBatchJob

This runs the multi-batch job specified using the INI section [MyMultiBatchJob] above. [MyMultiBatchJob] specifies 3 sequential jobs [MyDoCleanUp], [AnotherSection1] and [AnotherSection2]. (AnotherSectionX are example sections and not listed above).


HTML Help Commands

MakeHHC=, MakeHxT=, MakeHHK=, MakeHxK=, MakeHHP=, ExportNav=

The MakeXXX commands require a file list. To fill the file list use either: DIRSCAN=, DIR=, DROP_OPTIONS=, OpenFarList=, OpenFarSrch=.

Important: A Batch command can only contain one MakeXXX command. Use the /BB switch to run multiple commands.

New:12-Jul-2005: Added MakeHxT and MakeHxK. These are the MS Help 2.x versions of MakeHHC and MakeHHK. Actually MakeHHC and MakeHxT are the same, and MakeHHK and MakeHxK are the same. They call the same common function who's output is controlled by the supplied file's file extension. So you could give MakeHHC a file with a .hxt file extension and it would create a Help 2.x type TOC. That's just a little background info in case you try a odd file extension and don't get the desired result.

MakeHHC=xxx.hhc

This command auto-generates a  xxx.hhc table of contents file in the base folder where the drop files exist. Only the HTML type files in the drop list are used to create the HHC file.

Example:
DirScan='c:\proj\myhelpweb'         ; Recursively scan for files in this directory
MakeHHC='MyToc.hhc'                 ; Creates a TOC file MyToc.hhc in base folder

MakeHHK=xxx.hhk

Similarly this command will auto-generate a xxx.hhk index file from the xxx.hhc. MakeHHC= must also be specified to make MakeHHK= work.

MakeHHP=xxx.hhp

This command takes the current file list and adds the files (relative paths) to the [FILES] section of an existing HHP file (replaces the list). The HHP file must exist already in the file lists base folder.

Example:
DirScan='c:\proj\myhelpweb'         ; Recursively scan for files in this directory
MakeHHP='MyProj.hhp'                 ; Updates the file list in c:\proj\myhelpweb\MyProj.hhp

Convert Nav File Command

ExportNav=file1, file2

New:07-Feb-2007

The command loads a navigation file (file1) and exports it to another file format (file2) as defined in the file extensions.
File1 is the full path to an existing navigation file (.hhc, .hhk, .toc, .hxt or .hxk).
File2 is output file (again a .hhc, .hhk, .toc, .hxt or .hxk).
Take care as there is no overwrite prompt in batch mode.

Example:
ExportNav=c:\proj\contents.hhc , c:\out\contents.hxt


Link Check CHM Command

LinkCheckChm=, HtmlLogFile=, LinkCheckWarnings=, LinkCheckVerbose=, LinkCheckWebLinks=,LinkCheckCase=

18-Dec-2001

You can Link Check a CHM help file in batch mode. This is the same as opening a CHM file in the HH Utilities window, and performing a Link Check.

Important: A Batch command can only contain one LinkCheckChm= command. Use the /BB switch to run multiple commands.

LinkCheckChm='c:\test\help.chm'

The LinkCheckChm= command is followed by the name of the CHM file you want to link check. The CHM filename may be relative path (relative to the INI file folder).

The LinkCheckChm= command must be in its own INI section. Do not mix File List commands (See /B:filename.ini,SectionName section above), with LinkCheckChm= commands, otherwise only one will work.

HtmlLogFile=file0001.htm

Output the results of a CHM link check, in rich HTML format. HTML files cannot be appended to. If a relative path is specified (as with file0001.htm above) then HTML file is created relative to the INI file directory.

NOTE: If you output to HTML using HtmlLogFile= you will ONLY SEE SUMMARY INFO reported in the main text log file. The HTML output file will contain the entire link check log.

LinkCheckWarnings=y

Sets the Link Check Warning check box on or off.
Default is warnings on. Set to 'n' if you want to hide warnings messages. IE. Mailto: and http: and ftp: links that cannot be checked.

LinkCheckInComments=n         (new: 9-April-2005)

Default is off. Set to 'y' to enable checking of links inside HTML comments <!-- comment -->.
Remember some <script>sections are wrapped in comments so enable this if you want to to report links found inside script tags.

LinkCheckVerbose=n

Sets the Link Check Verbose check box on or off.
Default is off. Set to 'y' to enable verbose output.
This setting is really only useful when you are debugging.

LinkCheckWebLinks=n

Added 2/12/2005.
If you have an Internet Connection enable this to validate http: web links.
Default is off. Set to 'y' to enable web link checking.

LinkCheckCase=n

Added 29/05/2013.
Checks and reports if links have the same case as the target file.
eg <img src="ABC.gif"> will flag an error if the target file name has a different case than "ABC.gif" (eg "abc.gif")
This check is normally not required since Microsoft technology type links are not case sensitive. This was added for a client who needs single source support.
Also note that if you add a file 'abc.htm' to the [FILES] section of the .HHP project file as 'ABC.htm' it will be compiled into the .chm as 'ABC.htm'.
Default is off. Set to 'y' to enable web link checking.

 

Example INI file

File: FARBatch.ini

[BatchSection3]
FARBatch.ini,MyLinkCheckChm001
FARBatch.ini,MyLinkCheckChm002
FARBatch.ini,MyLinkCheckChm003

[MyLinkCheckChm001]
LinkCheckChm=farhelp.chm
LinkCheckWarnings=n
HtmlLogFile=file0001.htm


[MyLinkCheckChm002]
LinkCheckChm=Test\MyHelp.chm
HtmlLogFile=c:\results\file0002.htm

[MyLinkCheckChm003]
LinkCheckChm=d:\batchtest\Test\MyHelp.chm

Example of running a Link Check in batch mode (/b command)

FAR.EXE /b:d:\batchtest\FarBatch.ini,MyLinkCheckChm001

FAR reads the INI section [MyLinkCheckChm001] of FARBatch.ini, and runs the command LinkCheckChm=help.chm. Being a relative path, FAR expects to find help.chm in the same folder as the INI file.

Example of running a Link Check as a FAR "batch of batches" job (/bb command)

FAR.EXE /bb:d:\batchtest\FarBatch.ini,BatchSection3

This runs a multi-batch job using the INI section [BatchSection3] above. It performs links checks sequentially on 3 different CHM files. Actually 002 and 003 specify the same file, except 002 uses a relative file path, while 003 uses an absolute file path.

Note:


Help Batch Compile Command

BatchCompile=, BatchCompile_LogFile=, BatchCompile_LogLevel=, BatchCompile_ShowLog=

In the FAR Batch Compile window you can create a list of one or more project files (.HHP, .HxC, .HxM) stored in a .FBAT file, and compile the entire list of projects with all compile log output going to a single log File. To achieve this in batch mode use the BatchCompile= command. The command requires that you first setup a .FBAT file.

Important: A Batch command can only contain one BatchCompile= command. Use the /BB switch to run multiple commands.

 

Example: FAR /b:MyBatchFile.ini,MyBatchJob

Where MyBatchFile.ini contains 1 section.

[MyBatchJob]
BatchCompile = "d:\test.fbat"
BatchCompile_LogFile = "d:\MyLogFile.log"
BatchCompile_LogLevel = "3"
BatchCompile_ShowLog = "1"

BatchCompile=c:\path\file.fbat

This command compiles all projects listed in the specified .fbat file. The .fbat file can be first created and tested in the FAR Batch Compile window.

BatchCompile_LogFile=somefile.log  (optional)

This is optional. Specify the log file to output all help compiler output to during compilation. If not specified we use the name of the .fbat file with a .log file extension. This file is always written to. During compilation only brief messages are written to the main batch log file. To track down compile error details you will always need to go to this Batch Compile Log file.

Note: This can be confusing. We are now talking about 2 log files. There is the main FAR Batch log file (see /L switch) and this new one that collects the MS Help Compiler output (always contains verbose info in the help compile).

BatchCompile_LogLevel=3  (optional)

This is optional. Default is 3 -- log all Messages to the BatchCompile_LogFile, 2= Log Warnings and Errors Only, 1 = Log Errors errors only. If not specified all messages (3) is used.

BatchCompile_ShowLog=n  (optional)

Set this item to "y" to have the compiler log file automatically open at the end of compilation.


Copy/Backup Command

CopyTo=, BackupTo=

1-Dec-2003

The "Commands > Copy Files" command (see Copy Files dialog) allows you to copy the files from the file list to a new location. The Backup option copies files while preserving older versions of files (backup files are renamed, never overwritten). In the batch version of this command SmartCopy is always Enabled (ie. source files with same date and size as destination files are not copied).

These two commands (CopyTo and BackupTo) require a file list. To fill the file list use either: DIRSCAN=, DIR=, DROP_OPTIONS=, OpenFarList=, OpenFarSrch=.

Important: A Batch command can only contain one CopyTo= or BackupTo= command. Use the /BB switch to run multiple batch jobs (see example below).

CopyTo=c:\some\folder\

This command copies all files to the specified destination folder. This is the same as having the Backup Mode (Copy files dialog) = Unchecked. A trailing slash is not required.

    CopyTo_KeepAttributes=n  (optional)

Default=N (copied files have their file attributes cleared).
Set =Y to keep the file attributes when copying the files. This switch works only with the CopyTo= command.

    CopyTo_MatchesOnly=n  (optional)  -- [FAR Build in 768]

Default=N (copy all files).
Set =Y to copy only files with match > 0 (see main window matches column).

    CopyTo_LogLevel=1  (optional)

0 = Do not log extra info.
1 = Log all files copied (Default).
2 = Log all file copies and skipped.

BackupTo=c:\some\folder\

This command copies all files to the specified destination folder. This is the same as having the Backup Mode (Copy files dialog) = Checked. A trailing slash is not required.

    BackupTo_KeepAttributes=n  (optional)

Default=N (copied files have their file attributes cleared).
Set =Y to keep the file attributes when copying the files. This switch works only with the BackupTo= command.

    BackupTo_MatchesOnly=n  (optional)  -- [FAR Build in 768]

Default=N (backup all files).
Set =Y to backup only files with match > 0 (see main window matches column).

    BackupTo_LogLevel=1  (optional)

0 = Do not log extra info.
1 = Log all files copied and backed up (Default).
2 = Log all file copies and skipped.

 

02-May-2007

Note that the Copy Files dialog now has a popup menu command you can use to generate Copy batch script.

 

Example: FAR /b:MyBatchFile.ini,MyBatchJob

Where MyBatchFile.ini contains the following...

[MyBatchJob]
OpenFarSrch=D:\UVHelp\Test\mylist.far
CopyTo=c:\some\folder\
CopyTo_KeepAttributes=y
CopyTo_LogLevel=2

Description: FAR will open mylist.far (previously saved using File > Save) and use its BaseFolder and File Filter to populate the FAR file list. It then uses FAR Copy command to copy all files to c:\some\folder\ preserving all file attributes.

Example: FAR /bb:MyBatchFile.ini,BackupAllFiles

Where MyBatchFile.ini contains the following...

[BackupAllFiles]
MyBatchJob1
MyBatchJob2

;FAR /b:MyBatchFile.ini,MyBatchJob1  <-- comment line
[MyBatchJob1]
OpenFarSrch=D:\UVHelp\Test\mylist1.far
BackupTo=c:\some\folder1\

;FAR /b:MyBatchFile.ini,MyBatchJob2  <-- comment line
[MyBatchJob2]
OpenFarSrch=D:\UVHelp\Test\mylist2.far
BackupTo=c:\some\folder2\
CopyTo_KeepAttributes=y
CopyTo_LogLevel=2


Description: FAR /b:MyBatchFile.ini,MyBatchJob1
will open mylist1.far (previously saved using File > Save) and use its BaseFolder and File Filter to populate the FAR file list. It then uses the FAR Copy command to backup all files to c:\some\folder1\.

Similarly FAR /b:MyBatchFile.ini,MyBatchJob2
will open mylist2.far (previously saved using File > Save) and use its BaseFolder and File Filter to populate the FAR file list. It then uses the FAR Copy command to backup all files to c:\some\folder2\ preserving all file attributes. Keeping attributes and logging all files.

To run 2 backup commands one after another (in the same Batch job) we need to place the 2 ini section names above in a 3rd section (we have named [BackupAllFiles]). Now we can run both commands using the following command line:
FAR /bb:MyBatchFile.ini,BackupAllFiles


FTP Copy Command

FtpCopyTo=, FtpCopyTo_TraceOn=

1-Oct-2004

The "Commands > FTP Copy Files" command (see FTP Copy Files dialog) allows you to copy the files from the file list to a FTP Internet file server. This command require a file list. To fill the file list use either: DIRSCAN=, DIR=, DROP_OPTIONS=, OpenFarList=, OpenFarSrch=.

Important: A Batch command can only contain one FtpCopyTo= command. Use the /BB switch to run multiple batch jobs.

FtpCopyTo=MyFtpProfile

This command copies all list files to the FTP server and location specified in the supplied FTP Profile "MyFtpProfile". To setup an FTP Profile see the FTP Copy Files dialog.

FtpCopyTo_TraceOn=N  (optional)

Default=N (Verbose logging off).
Set = Y to enable verbose logging (all communication with the server is logged).

FtpCopyTo_TransferMode=Auto (optional)

Sets the transfer mode. Options are 'Auto', 'Binary', 'ASCII'.
Default=Auto

Example: FAR /b:MyBatchFile.ini,MyBatchJob

Where MyBatchFile.ini contains the following...

[MyBatchJob]
OpenFarSrch=D:\UVHelp\mylist.far
FtpCopyTo=My FTP Setup
FtpCopyTo_TraceOn=Y
FtpCopyTo_TransferMode=Auto

Description: FAR will open mylist.far (file list previously saved using File > Save) and use its BaseFolder and File Filter to populate the FAR file list.

It then uses FAR FTP Copy command to copy all files to an FTP Server defined by a profile called "My FTP Setup" (created previously using the "Commands > FTP Copy Files" dialog). Verbose logging is enabled.

 

Build JS Search Data File Command

The "Authoring > Build JavaScript Search" command (see Build JavaScript Search dialog) allows you to builds a SearchData.JS file. This command require a file list. To fill the file list use either: DIRSCAN=, DIR=, DROP_OPTIONS=, OpenFarList=, OpenFarSrch=.

Important: A Batch command can only contain one JSSearch = command. Use the /BB switch to run multiple batch jobs.

JSSearch = Y Set this to Y (or any string) to trigger the Build Search.
JSSearch_Filename = Optional. You normally don't set this unless you want to override the default output filename of 'SearchData.JS'.
JSSearch_IgnoreLen = 0 Optional. This is a numeric value (default = 0). If set to say 2 then words of length 2 and below ignored. Set to 0 to disable this option.
JSSearch_IgnoreNumsOnly = N Optional. This is a Boolean (Y/N) value (default = N). If set Y then search terms found containing all numbers are ignored.
JSSearch_StopWordFileList = Optional. Enter path of file containing stop word List. Default is '' meaning no stop word file is used.
JSSearch_ExtraChars = Optional. Enter path of file containing Addition Search Chars (above A..Z, a..z, _-). Default is no extra chars are used.
JSSearch_CodePage = Optional. If you are working with foreign language ANSI HTML files then you will need to tell FAR the code page to use when reading these files. EG. for Japanese set
  JSSearch_CodePage=932
The code pages are listed in the Build window.
If you are already on a Japanese PC then this is not required.
JSSearch_BreakCJK = N [10-Sept-2011 New for version 5.2.0.762]
Set this to Y to break apart Chinese/Japanese/Korean strings into smaller chunks (since these languages may not break paragraphs into words using spaces). This make searching easier but significant add to the size of the output file.

See the dialog help for more info.

Example 1: FAR /b:BuildSearchDataFile.FarRun,BuildJSSearch

Where BuildSearchDataFile.FarRun file contains the following...

[default]
/d:1
BuildJSSearch

[BuildJSSearch]
Drop_Options=FilterHTMOnly
DirScan="D:\Proj\vss\FAR\test\"
JSSearch = Y
JSSearch_Filename = SearchData.JS
JSSearch_IgnoreLen = 1
JSSearch_IgnoreNumsOnly = Y
JSSearch_StopWordFileList = StopWordFile.txt
JSSearch_ExtraChars = ExtraChars.txt
JSSearch_BreakCJK = Y

[FilterHTMOnly]
_opSkipDirs=0
_opSkipFiles=0
_opIncFiles=1
_opSkipDirsSL=_vti*|1|_private|0|_*|0|
_opSkipFilesSL=.zip|1|.exe|1|.com|1|.dll|0|.bak|1|.~*|0|.toc|1|.hhp|0|.chm|0|.hhk|0|.hhc|0|
_opIncFilesSL=.ht*|1|.jpg|0|.gif|0|.txt|0|

Description: FAR will recursively scan the folder "D:\Proj\vss\FAR\test\" for HTML files (using the file filter defined in [FilterHTMOnly]). FAR sets the base folder to "D:\Proj\vss\FAR\test\" then builds a SearchData.JS file in that folder.

The batch file has a .FarRun file extension and has a [default] section so you can optionally double click the BuildSearchDataFile.FarRun to run the batch job.

Example 2: FAR /b:BuildSearchDataFile.FarRun,BuildJSSearch

Where BuildSearchDataFile.FarRun file contains the following...

[default]
/d:1
BuildJSSearch

[BuildJSSearch]
OpenFarSrch=D:\UVHelp\mylist.far
JSSearch = Y

Description: Same as Example 1 except the file list is loaded from a .FAR file D:\UVHelp\mylist.far.

 

Make Uncompressed Help Command

The "Authoring > Make Uncompressed Help" command (see Make Uncompressed Help dialog) allows you to generate uncompressed help. This command does not require a file list.

Before running this command first manually open the Make Uncompressed Help dialog, select a based folder and setup your project settings. Once this is done you can call the batch command as many times as you like.

MakeUncompHelp = "c:\foldername\" Required. Specify the base folder.
MakeUncompHelp_Section="MySection" Optional. If specified this selects the dialog's section drop down (and thus selects a bank of settings). Default is use the last section selected.
MakeUncompHelp_CopyExtraFiles=N Optional. This sets the "Always Copy Auxillary Files" checkbox. Default is N (No).

MakeUncompHelp_CopyExtraFiles - Removed from FAR version 5.

Example 1: FAR /b:MakeUncompHelp.FarRun,MakeHelp

Where MakeUncompHelp.FarRun file contains the following...

[default]
/d:1
MakeHelp

[MakeHelp]
MakeUncompHelp = "c:\foldername\"
MakeUncompHelp_Section="JSBuild"
MakeUncompHelp_CopyExtraFiles=Y

Description: FAR opens the Make Uncompressed Help dialog, sets the base folder to "c:\foldername\", selects called "JSBuild" (if found), checks the "Always Copy Auxillary Files" checkbox and clicks the Create Navigation Files button.

The batch file has a .FarRun file extension and has a [default] section so you can optionally double click the MakeUncompHelp.FarRun to run the batch job.

 

TOC or Index File Merge

To automate the merging of several TOC or Index files, create .Merge file and use the BatchMergeFile= command.

See TOC / Index Merge for information on how to create a .Merge file

[default]
MergeHHc
MergeHHK

[MergeHHc]
BatchMergeFile= Test.hhc.Merge

[MergeHHK]
BatchMergeFile= Test.hhk.Merge

Description: Loads the file Test.hhc.Merge and generates a output file Test.hhc which is a merging of all files from the [Include] section of the .Merge file. Then it does similar for Test.hhk.Merge.

Encode Files Command

Added 27-Oct-2011, FAR 5.3.0.771

This command sets the file encoding for each file in the file list (same as FAR "Command > Set File Encoding" dialog).

Encode = "UTF8" Required. Specify the file encoding to set files to. See Encoding dialog for more information.
Valid values: 'ANSI', 'Unicode', 'UnicodeBigEndian', 'UTF8'
There is no default. Using an invalid value will cause the command to fail.
Encode_AddBOM = Y Optional. Default 'Y' (Yes) recommended.
Set = 'N' (No) to not add a BOM to each file (not recommended).
See Encoding dialog for more information.
Encode_CodePage = -1 Optional. Integer. Only required when converting to or from ANSI file encoding.
The default is -1 which represents the Operating System code page.
EG. 932 is the ANSI code page for Japanese. On an English PC you can use 932  to convert Japanese text files between ANSI and Unicode.
See Encoding dialog for more information.
Note: If characters lie outside the ANSI code page you may get a dialog pops up to ask you to choose a more suitable code page.
Encode_DetectMethod = 'DetectUsingBOM' Optional. Default = 'DetectUsingBOM' (recommended). Allowed string values: 'DetectUsingBOM', 'AutoDetect', 'AssumeUTF8ifNoBom', 'AssumeUTF16ifNoBom', 'AssumeUTF16BEifNoBom'.
See Encoding dialog for more information.

Example:

[default]
EncodingJob1
EncodingJob2

[EncodingJob1]
OpenFarList=D:\UVHelp\mylist1.far
Encode=UTF8

[EncodingJob2]
OpenFarList=D:\UVHelp\mylist2.far
Encode=UTF8
Encode_AddBOM=Y
Encode_CodePage=-1
Encode_DetectMethod=DetectUsingBOM

Description: Loads an explicit file list from the specified .FAR file then encodes all files in the list to UTF8.
EncodingJob2
actually does the exact same job since the parameters in EncodingJob2 are using default values anyway.

 

 


http://www.HelpwareGroup.com/