With the lister addstem command, you need to set up the compound variables
before you can add the entry to the lister. (See the lister query entry
command for a simple explanation of compound variables.)
To be able to add an entry using stems you must specify at the very least
a filename, the other information will be set to the defaults, (for example,
current date/time, no comment, rwed protection bits).
Example:
/* ListerAddstem1.dopus5 */
options results
address 'DOPUS.1'
dopus front
lister new mode name
handle = result
fileinfo.NAME = 'TestFile'
lister addstem handle fileinfo.
lister refresh handle
address command wait 3
lister close handle
dopus back
exit
This is equivalent to the AddFile command in Opus v4.
You can also get the information from a lister query entry command and
use that for adding an entry without modification.
Example:
/* ListerAddstem2.dopus5 */
options results
address 'DOPUS.1'
dopus front
lf = '0a'x
lister new mode name "S:"
handle = result
lister set handle display name comment version filetype
lister refresh handle full
lister wait handle
address command wait 2
lister query handle entry "Startup-Sequence" stem info.
text = 'We will get the information for the'||lf||,
'''Startup-Sequence'' file, and then'||lf||,
'change the path in the lister and'||lf||,
'add an entry with the same data.'
dopus request '"'text'" OK'
text = 'The following information is for the'||lf||,
'file ''S:Startup-Sequence'':'||lf||lf||,
'NAME = '||info.NAME||lf||,
'SIZE = '||info.SIZE||lf||,
'TYPE = '||info.TYPE||lf||,
'SELECTED = '||info.SELECTED||lf||,
'DATE = '||info.DATE||lf||,
'PROTECT = '||info.PROTECT||lf||,
'DATESTRING = '||info.DATESTRING||lf||,
'PROTSTRING = '||info.PROTSTRING||lf||,
'COMMENT = '||info.COMMENT||lf||,
'FILETYPE = '||info.FILETYPE||lf||,
'VERSION = '||info.VERSION||lf||,
'REVISION = '||info.REVISION||lf||,
'VERDATE = '||info.VERDATE||lf||,
'DATENUM = '||info.DATENUM||lf||,
'TIME = '||info.TIME
dopus request '"'text'" OK'
text = 'We will now add this entry'||lf||,
'to the lister after changing'||lf||,
'it''s path to ''RAM:'''
dopus request '"'text'" OK'
lister read handle "RAM:" force
lister wait handle
lister addstem handle info.
lister refresh handle
text = 'This hasn''t copied the file from ''S:'''||lf||,
'it has just copied the entry details for'||lf||,
'''Startup-Sequence'' into the lister display.'
dopus request '"'text'" OK'
text = 'If we reread the directory the entry'||lf||,
'will disappear because the file doesn''t'||lf||,
'exist in ''RAM:'''
dopus request '"'text'" OK'
lister read handle "RAM:" force
address command wait 3
lister close handle
dopus back
exit
While listers are mainly file manipulation interfaces, you can make them
display other information. There is a DISPLAY field that can be used to
display any text you want, it can contain up to 256 characters.
Two good examples of what you can use the DISPLAY field for are shown in my
Grep.dopus5, (used for displaying text search output), and Awari.dopus5
scripts, (a game in a lister). Both of these scripts should be available on
either Aminet by the time you read this, or on the DOpus PLUS CD.
Example:
/* ListerAddstem3.dopus5 */
options results
address 'DOPUS.1'
dopus front
lister new '0/11/150/200' mode name
hande = result
fileinfo.DISPLAY = 'Some really silly text demonstrating the DISPLAY field !@#$%^&*()_+|:?><,./][{}\=-`~'
lister addstem handle fileinfo.
lister refresh handle
address command wait 5
lister close handle
dopus back
exit
This is equivalent to using AddCustEntry command in Opus v4.
|