.key archive

; Script for AmiSearch II
; This script allows the user to have a program for DeliTracker
; with selected modules. Archives are unpacked if needed.
; Author : Franck ANIERE
; Version : 1.0

; Global variables part : you should customize it !

SET DECOMPDIR "Ram:"
SET LHA "C:Lha"
SET LZX "C:LZX"
SET DTPROG "Ram:modlist.program"
SET OUT "CON:0/16/640/100/AmiSearch II audio script/CLOSE/WAIT"
SET DTPATH "Aq1:Audio/Players"
SET DTP `TACKON $DTPATH DeliTracker2.27`
SET DTCONFIG `TACKON $DTPATH DELICONFIG/DeliTracker.config`
SET DTPLAY `TACKON $DTPATH DeliPlayers`
SET DTGENIE `TACKON $DTPATH DeliGenies`
SET DTOPT "CLOSEQUITS YES"

; If the directory doesn't exist we create it...

SET FULLDIR `Tackon $DECOMPDIR AS2Audio`
CD $DECOMPDIR
IF NOT EXISTS AS2Audio
 MAKEDIR AS2Audio
ENDIF

set TheFileName `BASENAME "<archive>"`

; First step : test if we have a LHA archive (.lha/.lzh)

SET TheBasename `BASENAME "$TheFileName" .lha`
IF NOT "$TheBasename" EQ "$TheFileName"
  $LHA -m x "<archive>" AS2Audio/ >$OUT
  SKIP COMMON
ENDIF

SET TheBasename `BASENAME "$TheFileName" .lzh`
IF NOT "$TheBasename" EQ "$TheFileName"
  $LHA -m x "$TheFileName" AS2Audio/ >$OUT
  SKIP COMMON
ENDIF

; Second step : test if we have a LZX archive

SET TheBasename `BASENAME "$TheFileName" .lzx`
IF NOT "$TheBasename" EQ "$TheFileName"
  $LZX -m x "$TheFileName" AS2Audio/ >$OUT
  SKIP COMMON
ENDIF

; So it seems to be a single module, so we copy it...

ECHO "Copying module..." >$OUT
COPY "<archive>" AS2Audio

; Now we can create a DT program

LAB COMMON

SET REALDIR `TACKON $FULLDIR ~(#?.readme|#?.txt|#?.diz|#?.guide)`
LIST $REALDIR LFORMAT="%p%n" > T:FirstFile
SORT T:FirstFile T:SecondFile
DELETE T:FirstFile ALL QUIET
ECHO "MODLIST" > $DTPROG
ECHO "" >> $DTPROG
TYPE T:SecondFile >> $DTPROG
DELETE T:SecondFile ALL QUIET
IF EXISTS $DTP
  RUN $DTP PLAYERPATH $DTPLAY GENIEPATH $DTGENIE CONFIG $DTCONFIG $DTOPT MODULE $DTPROG



