C

Structure of config files

Previous Next Index


All of the config files except the resource file are Tcl code. If you change something, do not touch anything else than the value of the variable. Even then you should be absolutely sure about what you are doing.

The format of Tcl variable setting is:

set _variable_  _value_



<MAIN RESOURCE> Resource file: xfilesrc
This file defines general options and startup configurations. The file is well commented so if you need to change anything, please check there. Remember that the startup configurations can later be changed, they are just the values for startup situation.

NOTE!
The startup directories that are defined in the resource file can be overruled by command-line arguments.

Syntax: X-Files [left_dir [right_dir]]



<ACTIONBUTTONS> Config file: xfiles.buttons
FORMAT:
set bargs(_index_) {_button-attributes_}
set bcomm(_index_) [list _Action-parameters_ _command_ _args_]

bargs() defines the out-look of the Tcl/TK-button.
bcomm() defines parameters for the command, the command itself and arguments.


Index:

Indices go from left to right, bottom to up, like this:

242526272829|303132333435
121314151617|181920212223
012345|67891011

Button attributes: Normal parameters for TK-Buttons
Action parameters: N = Normal (none)
Q = Quiet (for suppressing errors)
W = Output Window
U = Update listboxes
C = Confirm box
Commands: Refer to Appendix A
Args: Arguments for commands, refer to Appendix A


Examples:

(1)
To define button for program named "xv". We want to use that program to view the selected pictures:

set bargs(0) {-text XV}
* Button with label "XV"

set bcomm(0) [list N exec xv %f &]
* Executes xv, with selected files in "%f", in background (&)

(2)
We want to list the contents of a zipfile we have selected:

set bargs(23) {-text ZipLs -borderwidth 3 -relief groove -bg "#dcdcdc"}
* Button with label "ZipLs", and outlook parameters.

set bcomm(23) [list W exec unzip -l %f]
* Executes unzip and shows the output in OutputWindow.

For more examples, look the REAL xfiles.buttons file...



<EXTENSIONS> Config file: xfiles.extensions
FORMAT:
set _extension+button_ [list _Action-parameters_ _command_ _args_]

Action parameters: N = Normal (none)
Q = Quiet (for suppressing errors)
W = Output Window
U = Update listboxes
C = Confirm box
Extension+Button: Describes the extension and button combination.
Extension can be anything you want (jpg, gif, zip, tar.gz ..)
Button is either L or M (left or middle).
Commands: Refer to Appendix A
Args: Arguments for commands, refer to Appendix A


Examples:

(1)
Execute Xview-pictureviewer doubleclicking left mousebutton over gif-file. Run it in background.
set gifL [list N exec xv %f &]

(2)
Unzip zip-files with middlebutton in background with confirmation before execution.
set zipM [list C exec unzip %f -d %d &]

There is also one variable that has to be set:

set extlist [list _list_of_all_used_extensions+buttons_]

i.e. If you have defined gifL, jpgM and tclM then this looks like:

set extlist [list gifL jpgM tclM]

For more examples, look the REAL xfiles.extensions file..



<HEADERS> Config file: xfiles.headers
FORMAT:
set header(_button_._index_) [_header_]
set hcomm(_button_._index_) [list _Action-parameters_ _command_ _args_]

Button: Button is either L or M (left or middle).
Index: Index starting from 0.
Header: Set of numbers that represents decimal ASCII values in the beginning of the file.
It is also possible to convert string to decimal automatically using [String2Integer]-procedure.
Action parameters: N = Normal (none)
Q = Quiet (for suppressing errors)
W = Output Window
U = Update listboxes
C = Confirm dialogbox
Commands: Refer to Appendix A
Args: Arguments for commands, refer to Appendix A


There is also two other variables that has to be set:
set H(L) _last_index_+1 ; # Number of Headers (Left button)

set H(M) _last_index_+1 ; # Number of Headers (Middle button)


Examples:

(1)
Execute Xview for gif-files (in background):
set header(L.0) [String2Integer GIF8]
set hcomm(L.0) [list N exec xv %f &]

(2)
Execute Xview for jpg-files (in background):
set header(L.1) 25521625522401674707370
set hcomm(L.1) [list N exec xv %f &]

For more examples, look the REAL xfiles.headers file...
Previous Next Index