This script can be enhanced, of course. Like DOS command version, we could pass
an argument like 'full' to get additional information.
Try yourself before peeking the next script.
Hints:
Arguments are taken with Arg name [name]...
name now contains the argument given
We need to check if argument is given, find a good place for this
Instead of concatinated strings, a line break eases reading. Find a way.
Code:
/*
* $VER: VersionRequester 1.04 (04.07.15)
*
*
* Small REXX script to get version
* from selected files and filtering
* the output.
* There is no error checking.
*
* Requirements :
*
* DirectoryOpus v4.xx
* Version command in DOS search path
* PIPE-handler must be running
*
* Written by BigFan
* no copyright claims on basic stuff
* and no license idiocracy
*/
Arg fullversion
tempfile = 'pipe:versionstring'
numitem = 0
item3 = ''
Options RESULTS
DirOpus = Address()
Address value DirOpus
Status 3 /* get active pane */
actpane = RESULT
Status 9 actpane /* get selected files */
numitems = RESULT
If numitems = 0 | numitems = 'RESULT' Then Exit 5
Status 13 actpane /* get the current directory */
actdir = RESULT
Open('temp',tempfile,r)
Do i = 1 To numitems /* call version for each selected file */
GetNextSelected
item = RESULT
Address command 'version >' tempfile ' "'actdir||item'" file 'fullversion
item2 = Readln('temp') /* get the version string*/
vers = Word(item2,2) /* reduce to version number only*/
/* and check if it is a numeric value*/
If Datatype(Left(vers,3)) = NUM Then Do
If fullversion='FULL' Then Do /* check for argument */
item3 = Readln('temp') /* overwrite empty string */
If item3 ~= '' Then item3 = '0a'x item3 /* add a line break */
End
Verify item2 item3 /* call DirOpus requester to display*/
r = RESULT
If r=0 Then Do
Close('temp')
Exit 10
End
End
SelectFile item 0 /* deselect current file */
DisplayDir
End
Close('temp')
Exit 0 /* leave with no error code */