View Single Post
Old 04 July 2015, 13:47   #2
BigFan
Registered User
 
BigFan's Avatar
 
Join Date: Feb 2014
Location: Germany
Posts: 261
Using requesters

As this is much too simple and still uses intermediate files (which we have to
remove from RamDisk to save memory), here is a similar script to show each
version string in a requester. This time we send our data to PIPE: instead to
a file. This makes the script smaller and leaves no remains in RAM:

Code:
/*
 * $VER: VersionRequester 1.03 (30.06.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
 */

tempfile = 'pipe:versionstring'
numitem = 0

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'
 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
  Verify item2             /* 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 */

Last edited by BigFan; 04 July 2015 at 14:12.
BigFan is offline  
 
Page generated in 0.19489 seconds with 11 queries