Invoke external programs from Friday

Previous answer
Main page of Friday 101
Next answer

You can have Friday launch external programs and optionally pass command line parameters to these programs. To do this, you edit the FRIDAY.FQA file where you can add up to three such external commands, which we'll call "Externals"

Each External appears as a button on Friday's Advanced Settings dialog.

For example, to define an External that launches the FRIDAY.FQA file in Notepad, you would add this to FRIDAY.FQA:

[External1]
ButtonText=Edit FQA
; This text appears on the button - keep it short, the buttons are small!
FullPathToExe=notepad
; The full path to the program you want to launch
Parm1=ROOTDirfriday.txt
Parm2=
Parm3=
Parm4=
Parm5=

After you add this to your FRIDAY.FQA then press CTRL+A or choose FAQ, Advanced Settings and you'll see a button labeled "Edit FQA" on the Advanced Settings dialog. Click it and FRIDAY.FQA opens in Notepad.

Parm1 through Parm5 allow you to specify command line parameters
You can use literal text or special names that Friday replaces with paths

The special names are as follows:

Name Friday substitutes Example
ROOTDir The main folder for this FAQ C:\FAQs\Friday\
FAQDir The FAQ folder for this FAQ C:\FAQs\Friday\FAQ\
HTMLDir The HTML folder for this FAQ C:\FAQs\Friday\HTML\

Note that all paths are terminated with a backslash.

Here's another example, this time an External that backs up your FRIDAY.FQA file to a \BAK folder, creating it if necessary. To use this, you'll have to create BackupFAQ.BAT from the example text given below.

[External2]
ButtonText=Back up FQA
FullPathToExe=ROOTDirBackupFQA.BAT
Parm1=ROOTDir
; Note: you don't need to include the other ParmX= lines if you don't need to use them

When you click the Back up FQA button, Friday does this:
Substitutes the full path to your FAQ folder for ROOTDir and creates then executes this command:

C:\FAQs\Friday\BackupFQA.BAT C:\FAQs\Friday\

BackupFQA.BAT might contain something like this:

@echo off
rem Pass it: BackupFQA.BAT Path_Where_FQAFile_Lives
rem It makes (if necessary) a \BAK folder copies FRIDAY.FQA to it
rem Note: Friday's ROOTDir param gives a \-terminated pathname

if not exist %1BAK\nul goto MAKEFOLDER
rem If here, then folder must exist

rem If it exists, then delete the file, if there
if exist %1BAK\FRIDAY.FQA del %1BAK\FRIDAY.FQA > nul

rem Copy 
copy %1FRIDAY.FQA %1BAK > nul
goto END

:MAKEFOLDER
md %1BAK > nul
copy %1FRIDAY.FQA %1BAK > nul
goto END

:END
exit

Important Tip
Add this line:

DebugExternals=1

to the [App] section of FRIDAY.FQA to have Friday pause and display the command line it's about to execute when you click one of the Externals buttons. This will help you verify that the command line is correct.

We support Externals only as far as making sure that the external program is invoked with the command line and parameters specified in FRIDAY.FQA
We can't guarantee that an externally invoked program will behave the way you need it to.


Filename: FAQ00076.htm
Last edited on 8/9/2004 9:43:14 PM

Naturally, all content & site maintenance by

Friday The Automatic FAQ Maker