home *** CD-ROM | disk | FTP | other *** search
- /* Compare for Directory Opus 5
- By Leo Davidson ("Nudel", P0T-NOoDLE/Gods'Gift Utilities)
-
- $VER: Compare.dopus5 1.3 (18.8.95)
-
- NOTE: This script _requires_ DOpus v5.11 or above.
-
- Using an external AmigaDOS compare program, this will compare either:
- a) the first two selected entries in the source lister (if more than one
- entry is selected in the source lister), or,
- b) the selected entry in the source lister with the first selected entry
- in the destination lister.
-
- Where multiple soure/destination listers are open, only those listed
- first by DOpus5 will be used - so for the desired results you should
- only have one source and one destination lister (or just one source
- if you have two entries selected in it).
-
- Note: Whether comparing two directories, or even a directory with a
- file, works or not depends on the "Compare" command you use. This
- script will send the selected ENTRIES (file OR dir!) to the command -
- after this what happens is entirely up to the command itself!
-
- Call as:
- ------------------------------------------------------------------------------
- ARexx Compare.dopus5 {Qp}
- ------------------------------------------------------------------------------
- The "Output to window" and "Window close button" switches should both be on.
-
- You should change the "Address Command..." line near the end to work with
- whatever Compare command you prefer to use (you'll at least have to change
- it's path).
-
- v1.01 -> v1.02 - Now uses stem variables for getting the lister handles.
- Also tidied up a couple of minor things.
- Now checks to make sure the DOPUS.x port exists.
- v1.02 -> v1.3 - Now uses Show() instead of ShowList(). (Thanks Stoebi)
- Style Guide compliant version numbering and $VER string.
- */
-
- /*-- Main Program -----------------------------------------------------------*/
- options results
- options FAILAT 99
- signal on syntax;signal on ioerr
- PARSE ARG DOpusPort
- DOpusPort = Strip(DOpusPort,"B",'" ')
-
- If DOpusPort="" THEN Do
- Say "Not correctly called from Directory Opus 5!"
- Say "Load this ARexx script into an editor for more info."
- EXIT
- END
- If ~Show("P",DOpusPort) Then Do
- Say DOpusPort "is not a valid port."
- EXIT
- End
- Address value DOpusPort
-
- lister query source stem source_handle.
-
- IF source_handle.count = 0 | source_handle.count = "SOURCE_HANDLE.COUNT" Then Do
- dopus request '"You must have a SOURCE lister!" OK'
- EXIT
- End
-
- lister query source_handle.0 numselentries
- If RESULT = 0 Then Do
- dopus request '"You must have at least one entry' X2C(0A) 'selected in the SOURCE lister!" OK'
- EXIT
- End
-
- lister query source_handle.0 firstsel
- First_Name = RESULT
- lister select source_handle.0 First_Name 0
- lister query source_handle.0 path
- First_Name = Strip(RESULT,"B",'"')||Strip(First_Name,"B",'"')
- lister refresh source_handle.0
-
- lister query source_handle.0 numselentries
- drop source_handle.count
- If RESULT = 0 Then Do
- lister query dest stem source_handle.
- IF source_handle.count = 0 | source_handle.count = "SOURCE_HANDLE.COUNT" Then Do
- dopus request '"If you do not select TWO entries in the SOURCE lister,' X2C(0A) 'you must have a DESTINTION lister as well!" OK'
- EXIT
- END
- END
-
- lister query source_handle.0 numselentries
- If RESULT = 0 Then Do
- dopus request '"You must select a second entry in' X2C(0A) 'either the SOURE or DEST lister!" OK'
- EXIT
- END
-
- lister query source_handle.0 firstsel
- Second_Name = RESULT
- lister select source_handle.0 Second_Name 0
- lister query source_handle.0 path
- Second_Name = Strip(RESULT,"B",'"')||Strip(Second_Name,"B",'"')
- lister refresh source_handle.0
-
- Say 'Compare: "'First_Name'"'
- Say ' with: "'Second_Name'"'
- Say
-
- Address Command 'DH0:Tools/System/Utils/Compare_ "' || First_Name || '" "' || Second_Name || '"'
-
- syntax:;ioerr: /* In case of error, jump here */
- EXIT
-