ArcDir
The dopus getfiletype command is useful for just obtaining information
on what type an file is, or what the Filetype ID is for the file.
You can use it for determining if your script has been called with the
right type of file, that is, if your script is designed to handle LhA
archives it's hardly worthwhile having it trying to process a ZIP archive.
It can also be used to identify the Filetype ID of your argument, for
example, it will return 'LHA' if used to identify an LhA archive, (providing
that's what you use for an LhA Filetype ID of course).
Example:
/* DopusGetfiletype.dopus5 */
lf = '0a'x
options results
address 'DOPUS.1'
dopus front
address command 'RequestFile >ENV:testfile S: title "Pick a file"'
address command 'rxset getfiletype '$testfile
file = getclip('getfiletype')
dopus getfiletype file
text = 'The filetype is: 'result
dopus getfiletype file ID
if result ~= 'RESULT' | result ~= '' then
text = text||lf||lf||'The Filetype ID is: 'result'.'
else
text = text||lf||lf||'The Filetype ID is unknown.'
dopus request '"'text'" OK'
call delete('ENV:testfile')
dopus back
exit
|