ArcDir (There are many more than just this example in ArcDir.)
The lister query command allows you to retrieve information
on either the lister settings or entries in the lister.
You can retrieve information such as the sorting method, (name, date, etc),
the path, (RAM:, etc), total number of entries, (selected or not), just
selected files or directories, specific entry information, and much more.
The results of the lister query command will generally be returned in the
RESULT variable.
For example:
/* ListerQuery.dopus5 */
options results
address 'DOPUS.1'
lister new mode name "S:"
handle = result
call setclip('Lister.test',handle)
exit
Run the example and then click on the buttons below to obtain information
on the new lister.
lister query handle numentries
lister query handle numfiles
lister query handle separate
lister query handle flags
lister query handle path
lister query handle mode
lister query handle display
lister query handle busy
Click on this button to close the lister.
lister query can also be used to find the handle for the current Active, Source or
Destination lister. This is analogous to sending the {Ql} and {Qd} parameter
to the script, except with the ARexx version you can get the handles of all
listers.
Once you've found the Active lister, you can determine whether it is a
Source or Destination by comparing it to the list of handles retrieved for
all Source or Destination listers.
Example:
/* Lister.dopus5 */
lf = '0a'x
options results
address 'DOPUS.1'
lister close all
'lister new 1/1/100/100'
handle1 = result
lister wait handle1
lister set handle1 source lock
'lister new 1/110/100/100'
handle2 = result
lister wait handle2
lister set handle2 source lock
'lister new 1/220/100/100'
handle3 = result
lister wait handle3
lister set handle3 dest lock
'lister new 140/1/100/100'
handle4 = result
lister wait handle4
lister set handle4 dest lock
'lister new 140/110/100/100'
handle5 = result
lister wait handle5
lister set handle5 off
'lister new 140/220/100/100'
handle6 = result
lister wait handle6
lister set handle6 busy on
lister query all
text = 'Handles of All non-busy listers,'||lf||,
'there should be five of them:'||lf||,
result
dopus request '"'text'" OK'
lister query source var dummy
text = 'Handles of all Source listers,'||lf||,
'there should be two of them:'||lf||,
dummy
dopus request '"'text'" OK'
lister query dest var dummy
text = 'Handles of all Dest listers,'||lf||,
'there should be two of them:'||lf||,
dummy
dopus request '"'text'" OK'
text = 'You''ll have five seconds to make a non-busy'||lf||,
'lister active, just click on it''s titlebar,'||lf||,
'then I''ll tell you it''s handle and state.'
dopus request '"'text'" OK'
address command wait 5
lister query active
if result = 'RESULT' | result = 0 then
dopus request '"You didn''t activate one!" OK'
else do
handle = result
text = 'The Active lister''s handle is: 'handle
lister query source
if pos(handle,result) > 0 then
text = text||lf||'It is a SOURCE lister.'
else do
lister query dest
if pos(handle,result) > 0 then
text = text||lf||'It is a DESTINATION lister.'
else
text = text||lf||'It''s state is OFF.'
end
dopus request '"'text'" OK'
end
lister set handle6 busy off
lister close all
exit
Edmund's SwapListers , Leo's WinCopy and SwapWin and the CDO.dopus5
provide some real-life examples of how this can be used.
There is much more information that can be obtained through the lister query ,
please refer to the DOpusM2_ARexx.guide for the other options.
|