/************************************************************************* Pack_kat.rexx 0.2 (1.3.96) by Eric Sauvageau Script for XPkatana - Will pack the specified file with the (optional) specified packer. Specifying "?" as the source file will open a file requester, asking for the source. Usage: Pack_kat.rexx [packer] **************************************************************************/ /*** We want ANSWERS!!! :) ***/ Options results /*** We need to get the shell's path, so XPKatana will be able to locate the desired source file if XPKatana can't locate it. ***/ path = Pragma('D','') If Right(path,1) ~= ':' Then path = path||'/' /*** I wanna talk to ya :) ***/ Address 'KATANA' /*** Retrieve the arguments from the command line ***/ Parse Arg source packer If source = "" Then Do Say "You must supply a source file, or use "?" for a file requester." Exit 10 End /*** Tell XPKatana what is the source file. ***/ SETSOURCE source ; found = result /***** If XPKatana can't find it, then try again, but adding the current process's full path. *****/ IF (found = 'NOFILE') & (source ~= '?') Then SETSOURCE path||source /*** Store the current packer, packmode and NoProgress. ***/ GETMODEINFO 1 ; oldmode = result GETLIBINFO 1 ; oldpacker = result GETFLAG NOPROGRESS ; oldprogress = result /***** If there's a specified packer, use it. If not, the current one will be used instead. *****/ If packer ~= "" Then Do SETPACKER packer oldmode ; error = result If error = "BADPACKER" Then Do Say 'Invalid packer!' Exit 10 End End /*** Set XPKatana to "No progress window". ***/ SETFLAGS NOPROGRESS 1 /***** Pack the file, keeping the same filename (unless "Handle Suffix" was previously enabled *****/ Say "Packing..." PACK ; error = result If error = "ABORT" Then Do Say "Packing aborted or failed!" End Else Do /*** Examine the packed file to retrieve the ratio. ***/ EXAMINE ; e_string = result Parse Var e_string e_filename e_packer e_encrypted e_ratio e_description Say "Packed with "||e_packer||" (Gain: "||e_ratio||"%)." End /*** Restore the settings, and exit. ***/ SETPACKER oldpacker oldmode SETFLAGS NOPROGRESS oldprogress Exit