home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************
- $VER: DO5-Pack_kat.rexx 1.0 (19.12.95) Georges 'Melkor' Goncalves
- Written by Georges 'Melkor' Goncalves and Eric Sauvageau.
-
- ARexx Script for DOpus 5 to crunch selected files via XPKatana.
-
- Usage:
-
- <ARexx> DO5-Pack_kat.rexx <packer>
-
- Note: XPKatana is copyright © Eric Sauvageau and it does NOT belong to the
- DOpus5 distribution. It's ShareWare.
- ***************************************************************************/
-
- Options Results
- Options FailAt 25
-
- /* Adjust this as needed */
- XPKATANA_PATH = "SYS:Utilities/XPKatana"
-
-
- Parse Arg packer
-
- /* Should check if DOpus is really there */
-
- If ~Show('p',"DOPUS.1") Then Do
- Say "This script should be used with DirectoryOpus running!"
- Exit 20
- End
-
-
- /* We have to actually verify is XPKatana is running. */
- If ~SHOW('p',"KATANA") Then Do
-
- /* IF XPKatana is not already running, start it ! */
- started = 1
- Address Command "run <>NIL: "||XPKATANA_PATH||" ICONIFY"
- Address Command "WaitForPort KATANA"
- End
-
-
- address 'DOPUS.1'
-
- If packer = "" Then Do
- dopus request '"You need to supply a packer as the argument!" Damn!'
-
- Address 'KATANA'
- If started = 1 Then Do
- Quit
- End
-
- Exit 0
- End
-
- lister query source /* Is there any source lister ? */
- SRCHandle=RESULT
-
- if SRCHandle="RESULT" Then Do
- dopus request '"You need a source lister to use this script :-)" Damn!'
-
- Address 'KATANA'
- If started = 1 Then Do
- Quit
- End
-
- Exit 0
- end
-
- lister query SRCHandle selfiles /* Returns the name of selected files separated by space */
- Files=RESULT
-
- lister query SRCHandle numselfiles ; selected = result
-
- if selected=0 Then Do
- dopus request '"No source file(s) selected!" Damn!'
-
- Address 'KATANA'
- If started = 1 Then Do
- Quit
- End
-
- Exit 0
- end
-
- lister set SRChandle busy 1 /* Busy the lister */
-
- lister query SRChandle path /* Returns the source path */
- Path = RESULT
-
-
- /* Talk to XPKatana */
- Address 'KATANA'
- GetFlag NOPROGRESS ; oldflag = result
- SetFlags NOPROGRESS 1
-
- SetPacker packer 100 ; error = result
- If error ~= "OK" Then Do
-
- Address 'DOPUS.1'
- dopus request '"Invalid packer supplied!" Damn!'
- Signal ExitScript
- End
-
-
- Do Forever
- Parse Var Files afile Files /* Pull the first file and keep the remain */
- If afile == '' Then Leave
- completefile = path||Strip(afile,'B','"') /* Add path, strip "" */
-
- SetSource completefile
- Pack ; error = result
- /* Un-select the processed file */
- Address 'DOPUS.1'
- If error = 'ABORT' Then Do
- dopus request '"Error while packing "'||afile||'"!" Damn!'
- End
-
- lister select SRCHandle afile off
-
- Address 'KATANA' /* Switch back to the Katana port */
- End
-
-
- ExitScript:
-
- /* Close XPKatana if we started it */
- Address 'KATANA'
- If started = 1 Then Do
- Quit
- End
- Else Do
- SetFlags NOPROGRESS oldflag
- End
-
-
- Address 'DOPUS.1'
-
- lister set SRCHandle busy 0 /* Un-busy the lister */
- lister refresh SRCHandle
-