Skip to content

Latest commit

 

History

History
186 lines (155 loc) · 11.1 KB

FoxBin2Prg_Run.md

File metadata and controls

186 lines (155 loc) · 11.1 KB

FoxBin2Prg - Usage in command line style

Documentation of FoxBin2Prg - A Binary to Text converter for MS Visual Foxpro 9

Purpose of this document

This document shows how to run FoxBin2Prg from MS Windows Commandline, VFP's Command window or as SendTo.

The original document was created by Fernando D. Bozzo whom I like to thank for the great project.
Pictures are taken from the original project.
As far as possible these are the original documents. Changes are added where functionality is changed.


Table of contents


Run FoxBin2Prg

FoxBin2Prg might be used as an EXE either from Windows or VFP, or as as prg from inside VFP. Additional it might be integrated as an VFP Object using the Object version.
Since the EXE is basically the prg packed with some controling files, the way to call it ist mostly similar. The knowledge of differences in calling, DO .. WITH syntax separating parameters with "," and the DOS way off calling will be assumed. Do the similarity of the call, the prg version takes all parameters as strings too.

For settings and other related stuff see Internals.

Differences on excecution

EXE

The exe contains the most controling structures and the program itself. Alongside the FoxBin2Prg.exe must be _FileName_Caps.exe . It is recomended to have a general FoxBin2Prg.cfg configuration file in the folder with the EXE, but it will run without.

Remember, the Exe needs to be created first.

PRG

The prg is just the program and needs to find the controling structures. In particular:

  • FileName_Caps.exe
  • Props*.txt
  • FileName_Caps.exe
  • FoxBin2Prg.cfg is recomended

Note

All mentioned files need to be in the same folder. You can't use just the PRG without the rest of the mentioned files.

Parameters

FoxBin2Prg.EXE ...
could be used from VFP command line as
DO FoxBin2Prg.EXE WITH ...
or
DO FoxBin2Prg.prg WITH ...
or via RUN or more sophisticated ways.

Remember that using the prg style, parameters must be wrapped in string delimiters.

Note

Do to the compatibility with VSS the usage of cInputFile and cType is odd.

Important note:

When you process a directory, it is used as the base for the compilation of Binaries, and because of this, never process more than one directory in the same process, because the compilation may not be ok. To process more than one directory (or project), just select and process each one independently, in parallel if you like, but in different processes.

Usage

Usage 1

FoxBin2Prg.EXE cInputFile [,cType [,cTextName [,lGenText [,cDontShowErrors [,cDebug [,cDontShowProgress [,cOriginalFileName [,cRecompile [,cNoTimestamps [,cCFG_File [,cOutputFolder ] ] ] ] ] ] ] ] ] ] ] ]

Parameter Value (Default) Description
cInputFile ? / interactive Call interactive list of parameters
fullpath Full name of the file to convert or directory name to process
without any other parameter given, the extension (and the config) defines the operation
FileName::ClassName If option UseClassPerFile is 1 or 2, a class-file will be extracted from the lib
cType empty Fileextension of cInputFile defines operation
BIN2PRG cInputFile is processed for generating a Text representation.
PRG2BIN cInputFile is processed for generating the Binary file(s).
INTERACTIVE A confirmation dialog will be shown when processing a directory asking what to convert.
This option overrides the BIN2PRG and PRG2BIN parameters.
Can be used with or without PRG2BIN or BIN2PRG
SHOWMSG A status message will be shown on termination.
* If cInputFile is a project (pj[x2]) all files of the project, including the pjx, will be processed. The extension defines direction of operation.
*- If cInputFile is a project (pj[x2]) all files of the project, excluding the pjx, will be processed. The extension defines direction of operation.
d, D, K, B, M, R, V SCCAPI (SCCTEXT.PRG) compatibility mode, query the conversion support for the file type specified
Types: d=DBC, D=DBF, K=Form, B=Label, M=Menu, R=Report, V=Class
cTextName Text filename. Only for SCCAPI (SCCTEXT.PRG) compatibility mode. File to use.
lGenText .T., .F. Only for SCCAPI (SCCTEXT.PRG) compatibility mode.
.T.=Generates Text, .F.=Generates Binary.
Note: cType have predominance over lGenText
cDontShowErrors 0, 1 '1' for NOT showing errors in MESSAGEBOX
cDebug 0, 1, 2 '0 'no debug, '1' for generating process LOGs, stop on errors, '2' like '1' and special log.
This has precedence over any value in the config files.
cDontShowProgress 0, 1, 2 '0' show progress, '1' for not showing the process window, '2' Show only for multi-file processing
cOriginalFileName text used in those cases in which inputFile is a temporary filename and you want to generate the correct filename on the header of the Text version
cRecompile 0, 1 Indicates recompile ('1') the Binary once generated.
True if called from SCCAPI (SCCTEXT.PRG) compatibility mode.
path The Binary is compiled from this path
cNoTimestamps 0, 1 Indicates if timestamp must be cleared ('1' or empty) or not ('0')
cCFG_File filename Indicates a special CFG filename for default values.
Note, if the "regular" config files are used or not, is controlled by the setting AllowInheritance in this* file.
cOutputFolder folder Optional. A folder to write the output to. If not used, output be the source path.

Note #1

The BIN2PRG, PRG2BIN, INTERACTIVE, SHOWMSG cTypes might be mixed freely like:
PRG2BIN-INTERACTIVE
BIN2PRG-INTERACTIVE-SHOWMSG

Note #2

On any combination of (BIN2PRG, PRG2BIN, INTERACTIVE, SHOWMSG) separated by a "-", cType and cInputFile parameters can be swapped.
This is useful when used as EXE dealing with Windows shortcuts, on which fixed parameters must be in the shortcut.
The filename is an external variable parameter received when SendingTo FoxBin2Prg with right-click on File Manager.

Usage 2

FoxBin2Prg.EXE c|C|t [OutFileName [ cCFG_File[ cDebug]]]
DO FoxBin2Prg.EXE WITH -c|-C|-t [, OutFileName [, cCFG_File[, cDebug]]]

Parameter Description
none Call Info screen
-c (c) creates a template config-file cOutputFile ( like FOXBIN2PRG.CFG )
-C (C) creates a config-file cOutputFile ( like FOXBIN2PRG.CFG ) with the recent options used on the path of cOutputFile
If cOutputFile is empty, a file FOXBIN2PRG._CFG will be created in default foder.
-t (t) creates a template table-config-file cOutputFile ( like _TableName_.dbf.cfg )
cCFG_File Indicates a special CFG filename for default values
Note, if the "regular" config files are used orn not, is controlled by the setting AllowInheritance in this* file.
cDebug '1' for generating process LOGs, stop on errors
This has precedence over any value in the config files.

Usage 3

FOXBIN2PRG.EXE VERNO
DO FOXBIN2PRG.EXE WITH "VERNO"|cPara

Parameter Description
-VERNO (VERNO) Return version number of FoxBin2Prg
cPara A parameter with the Value "VERNO", the version number is returned to this parameter

Note

From command line the call with paramters like -c, -C -t is not possible. Those parameters will be removed by VFP itself. Just call without the dash. Calling inside VFP with DO FoxBin2Prg.EXE works with this dashed parameters.

Return values

Return value via ErrorLevel is 0=OK, 1=Error.

Examples

Using the "EXE" version: (useful for calling from 3rd party programs)

command description
FOXBIN2PRG.EXE "<path>\file.scx" Generates the Text version
FOXBIN2PRG.EXE "<path>\file.sc2" Generates the Binary version
FOXBIN2PRG.EXE "<path>\proj.pjx" "*" Generates the Text files for all the files in the PJX, including the PJX
FOXBIN2PRG.EXE "<path>\proj.pj2" "*" Generates the Binary files for all the files in the PJ2
FOXBIN2PRG.EXE "<path>\proj.pjx" "*-" Generates the Text files for all the files in the PJX, excluding the PJX
FOXBIN2PRG.EXE "<path>\file.vcx::cus_client" Generates only the Text version of the individual class cus_client of file.vcx (with UseClassPerFile:1 or 2)
FOXBIN2PRG.EXE "<path>\proj.pj2" "*" | find /V "" Generates the Binary files for all the files in the PJ2 and outputs to stdOut

Using the "PRG" version:

command description
DO FOXBIN2PRG.PRG WITH "<path>\file.scx" Generates the Text version
DO FOXBIN2PRG.PRG WITH "<path>\file.sc2" Generates the Binary version
DO FOXBIN2PRG.PRG WITH "<path>\proj.pjx", "*" Generates the Text files for all the files in the PJX, including the PJX
DO FOXBIN2PRG.PRG WITH "<path>\proj.pj2", "*" Generates the Binary files for all the files in the PJ2
DO FOXBIN2PRG.PRG WITH "<path>\proj.pjx", "*-" Generates the Text files for all the files in the PJX, excluding the PJX
DO FOXBIN2PRG.PRG WITH "<path>\file.vcx::cus_client" Generates only the Text version of the individual class cus_client of file.vcx (with UseClassPerFile:1 or 2)
DO FOXBIN2PRG.PRG WITH "<path>\file.cus_client.vc2" Generates only the Binary version of the individual class cus_client of file.vcx (with UseClassPerFile:1 and RedirectClassType:2)
DO FOXBIN2PRG.PRG WITH "<path>\file.vc2::cus_client::import" Generates only the Binary version of the individual class cus_client of file.vcx (with UseClassPerFile:1)

Explorer SendTo

To use FoxBin2Prg from the File Explorer, you can create 3 shortcuts of FoxBin2Prg.exe and move them to "SendTo" folder on your Windows profile.
Hint: type shell:sendto in File Explorer's address bar and it will open send to folder, so you can "send" the selected file (pjx,pj2,etc) to the selected option, and make on-the-fly conversions, then rename and edit those shortcuts as this (make sure you can see system file extensions):

Name------------------------  Right-click/Properties/destination-----------
FoxBin2Prg - Binary2Text.lnk  <path>\foxbin2prg.exe "BIN2PRG-SHOWMSG"
FoxBin2Prg - Text2Binary.lnk  <path>\foxbin2prg.exe "PRG2BIN-SHOWMSG"
FoxBin2Prg.lnk                <path>\foxbin2prg.exe "INTERACTIVE-SHOWMSG"

VFPX logo
This project is part of VFPX.


Last changed: 2023/11/26 Picture