home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / FileMover / Dopus5 / tradecfg.lha / arexx / TradeTool.dopus < prev   
Encoding:
Text File  |  1995-06-09  |  15.1 KB  |  551 lines

  1. /* 
  2.   $VER: Trade Tool V1.1 for DOpus 5, (08-06-95) Side\X/inder / LSD
  3.   
  4.   Written by Side\X/inder of LSD
  5.   
  6.   ARexx script for DOpus 5 to unpack files with progress indication.
  7.   Also views and edits the File_Id.diz, Saves the 'Diz' to a file to 
  8.   make a list, much like /X
  9.     
  10.   
  11.   Call as 'AREXX:TradeTool.dopus {f} FLAGS=Do All Files'.
  12.  
  13. */
  14.  
  15. options results
  16. options failat 21
  17. flag=Exists("Libs:rexxreqtools.library")
  18. if flag=0 then do
  19.     say "! ERROR ! Libs:RexxReqTools.Library not found."
  20.     Exit
  21. end
  22. addlib("rexxreqtools.library",0,-30)
  23. lf='0a'x  /* ascii code for linefeed */
  24. signal main
  25.  
  26.  
  27.  
  28. FileList:
  29.  
  30. call close('FileID')
  31.  
  32. /****          EDIT HERE           |-----------------|     FOR YOUR OWN PATH PREFERENCE    ****/
  33. /****                              v                 v                                     ****/
  34. address command 'dldiz f q lt=a ln=Work:Comms/FileList ' ||file
  35. /****                              ^                 ^                                     ****/ 
  36. /****          EDIT HERE           |-----------------|     FOR YOUR OWN PATH PREFERENCE    ****/
  37.  
  38. exit
  39. end
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. MAIN:
  50.  
  51. dest='RAM:T/'
  52. address 'DOPUS.1'
  53. parse arg '"' file '"'
  54. address command 'Delete T:File_Id.Diz'
  55.  
  56. if upper(right(file,4))='.DMS' then signal dms
  57. if upper(right(file,4))='.LHA' then Signal lha
  58. if upper(right(file,4))='.LZH' then Signal lha
  59. if upper(right(file,4))='.LZX' then Signal lzx
  60. if upper(right(file,4))='.NFO' then Signal txt
  61. if upper(right(file,4))='.DOC' then Signal txt
  62. if upper(right(file,4))='.TXT' then Signal txt
  63. if upper(right(file,4))='.EXE' then Signal exe
  64. if upper(right(file,4))='.GIF' then Signal gif
  65. if upper(right(ffile,4))~='' then signal no
  66.  
  67. No:
  68.  
  69. Call rtezrequest("Trade Tool V1.1 By Side\X/inder of LSD" lf " " lf "Im Sorry But Only The Following Formats Accepted At The Moment." lf " DMS - LHA - LZH - LZX - TXT - NFO - DOC - EXE - GIF" lf " " lf " If You Wish To Get The Latest Release Of This Program " lf " " lf " Then Call  " lf " And Leave A Message To Me  " lf " " lf " Okay That About Wraps It For Now Catch You Again Soon.." lf "Quit for Greetz","_Quit|_Exit","Trade Tool V1.1 ©95 By Side\X/inder of LSD ", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  70.  if RTResult = 1 then signal Quit
  71.  if rtresult = 0 then signal 
  72. exit
  73. end
  74. Quit:
  75. Call rtezrequest(" Hold on a moment, Greets from " lf lf " -//-  Side\X/inder  -//- " lf lf "TO" lf lf "All in LSD" lf lf "MDR - ZEALOT - ACE - VENOM - TANGO - COLLECTOR "lf" "lf"All the rest of the guyz on"lf lf"CEMENT CITY - TANGOLAND - 13th HOUR - LAST DROP - SOAP CITY","_L8trzz","Trade Tool V1.1 ©95 By Side\X/inder of LSD", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1) 
  76. exit
  77. end
  78.  
  79. /* ----------------------------------------------------------------------- */
  80.  
  81. LHA:
  82.  
  83. cuthere=lastpos('/',file)
  84. if cuthere=0 then
  85.    cuthere=pos(':',file)
  86. lhaname="'"substr(file,cuthere+1)"'"
  87.  
  88. fileidl:
  89.  
  90. if exists('T:FILE_ID.diz')then address command 'delete T:FILE_ID.diz quiet'
  91. ADDRESS command 'lha x > NIL: '||file||' FILE_ID.diz T:' 
  92.    if ~exists('T:FILE_ID.diz')then Signal Contl
  93. Showme=""
  94. call open('FileID','T:FILE_ID.diz','r')
  95. do until eof('FileID')
  96. Showme=Showme||lf||readln('FileID')
  97. end
  98.  
  99. contl:
  100.  
  101. rtezrequest(" " showme " ","E_xtract|_Edit|_About|_To List|_Next","Trade Tool V1.1 By Side\X/inder of LSD","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  102.  
  103. if rtresult = 1 then signal lhaw
  104. if rtresult = 2 then signal ledit
  105. if rtresult = 3 then signal about
  106. if rtresult = 4 then signal filelist
  107. if rtresult = 0 then exit
  108. end
  109.  
  110. ledit:
  111.  
  112. address command 'lha x > NIL: '||file||' FILE_ID.diz T:'
  113. address command 'copy ram:t/FILE_ID.diz ram:'
  114. dopus back
  115. address command 'ed ram:FILE_ID.diz'
  116. dopus front
  117. call rtezrequest("Repack your New File Id ?.","_OK|_Cancel","Trade Tool V1.1 By Side\X/inder of LSD ","RT_ReqPos=ReqPos_CenterScr rt_PubScrName = "DOPUS.1)
  118. if rtresult = 1 then signal lhapack
  119. if rtresult = 0 then exit
  120. end
  121.  
  122. lhapack:
  123.  
  124. address command 'lha d > NIL: '||file||' FILE_ID.diz '
  125. address command 'lha a > NIL: '||file||' ram:FILE_ID.diz'
  126. address command 'delete ram:file_id.diz'
  127. exit
  128. end
  129.  
  130. lhaw:
  131.  
  132. rtezrequest(" Please Select " lf " Ram:T/ Or Select (Another Path.)","_Ram:T/|_Select|_Next","Trade Tool V1.1 by Side\X/inder of LSD ", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  133. if rtresult = 1 then signal lhaw1
  134. if rtresult = 2 then signal select
  135. if rtresult = 0 then exit
  136. select:
  137. dirname = rtfilerequest(, , "Please Pick A Directory",,,
  138. "rtfi_flags = freqf_nofiles rtfi_initialpath=Ram:T/ RT_ReqPos=ReqPos_CenterScr rt_PubScrName = "DOPUS.1) 
  139. if rtresult == 0 then signal fail
  140. else
  141. dest=dirname
  142. signal lhaw1
  143. end
  144.  
  145. lhaw1:
  146.  
  147. lister new
  148. handle=result
  149.  
  150. lister set handle busy on
  151. lister set handle path dest
  152. lister set handle progress 'Unpacking' lhaname'...' 
  153.  
  154. address command 'C:LHA x -x -M 'file dest
  155.  
  156.        parse var line ' ' line
  157.           lister query handle abort
  158.          if result then do
  159.             address command 'Break' process 'C'
  160.             lister set handle busy off
  161.             lister set handle title 'UnLHA Aborted Or Finished...'
  162.             exit
  163.             end
  164.  
  165. lister set handle busy off
  166. lister read handle dest force
  167.  
  168. exit
  169. end
  170.  
  171. */ ----------------------------------------------------------------------- */
  172.  
  173. LZX:
  174.  
  175. cuthere=lastpos('/',file)
  176. if cuthere=0 then
  177.    cuthere=pos(':',file)
  178. lzxname="'"substr(file,cuthere+1)"'"
  179.  
  180. fileidl:
  181.  
  182. if exists('T:FILE_ID.DIZ')then address command 'delete T:FILE_ID.DIZ quiet'
  183. ADDRESS command 'LZX x > NIL: '||file||' File_Id.Diz Ram:T/' 
  184.    if ~exists('T:File_Id.Diz')then Signal Contx
  185. Showme=""
  186. call open('FileID','T:FILE_ID.diz','r')
  187. do until eof('FileID')
  188. Showme=Showme||lf||readln('FileID')
  189. end
  190.  
  191. contx:
  192.  
  193. rtezrequest(" " showme " ","E_xtract|_Edit|_About|_To List|_Next","Trade Tool V1.0 By Side\X/inder of LSD", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  194.  
  195. if rtresult = 1 then signal lzxw
  196. if rtresult = 2 then signal lzedit
  197. if rtresult = 3 then signal about
  198. if rtresult = 4 then signal filelist
  199. if rtresult = 0 then exit
  200.  
  201. lzedit:
  202.  
  203. address command 'LZX x > NIL: '||file||' File_Id.Diz Ram:'
  204. dopus back
  205. address command 'ed ram:File_Id.Diz'
  206. dopus front
  207. call rtezrequest("Repack your New File Id ?.","_OK|_Cancel","Trade Tool V1.1 By Side\X/inder of LSD ","RT_ReqPos=ReqPos_CenterScr rt_PubScrName ="DOPUS.1)
  208. if rtresult = 1 then signal lzxpack
  209. if rtresult = 0 then exit
  210. end
  211.  
  212. lzxpack:
  213.  
  214. address command 'lzx r > NIL: '||file||' ram:File_Id.Diz '
  215. address command 'delete ram:file_id.diz' 
  216. exit
  217. end
  218.  
  219. lzxw:
  220.  
  221. rtezrequest(" Please Select " lf " Ram:T/ Or Select (Another Path.)","_Ram:T/|_Select|_Next","Trade Tool V1.1 by Side\X/inder of LSD", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  222. if rtresult = 1 then signal lzxw1
  223. if rtresult = 2 then signal select1
  224. if rtresult = 0 then exit
  225. select1:
  226. dirname = rtfilerequest(, , "Please Pick A Directory",,,
  227. "rtfi_flags = freqf_nofiles rtfi_initialpath=Ram:T/ RT_ReqPos=ReqPos_CenterScr rt_PubScrName = "DOPUS.1) 
  228. if rtresult == 0 then signal fail
  229. else
  230. dest=dirname
  231. signal lzxw1
  232. end
  233.  
  234. lzxw1:
  235.  
  236. call close('FileID')
  237. address command 'Delete Ram:t/?#.* ALL'
  238.  
  239. lister new
  240. handle=result
  241.  
  242. lister set handle busy on
  243. lister set handle path dest
  244. lister set handle progress 'Unpacking' lzxname'...' 
  245.  
  246. address command 'lzx -x x 'file dest
  247.  
  248.        parse var line ' ' line
  249.           lister query handle abort
  250.          if result then do
  251.             address command 'Break' process 'C'
  252.             lister set handle busy off
  253.             lister set handle title 'UnLzx Aborted Or Finished...'
  254.             exit
  255.             end
  256.  
  257. lister set handle busy off
  258. lister read handle dest force
  259. exit
  260. end
  261.  
  262. /* ----------------------------------------------------------------------- */
  263.  
  264. DMS:
  265.  
  266. cuthere=lastpos('/',file)
  267. if cuthere=0 then
  268.    cuthere=pos(':',file)
  269.    dmsname="'"substr(file,cuthere+1)"'"
  270.    
  271.    
  272. fileidd:
  273.    
  274. if exists('T:FILE_ID.diz')then address command 'delete T:FILE_ID.diz quiet'
  275.  ADDRESS command 'dmsdescript > NIL: x T:FILE_ID.diz '||file
  276.   IF~exists('T:FILE_ID.diz')then signal Contd
  277. else do
  278. Showme=""
  279. call open('FileID','T:FILE_ID.diz','r')
  280. do until eof('FileID')
  281. Showme=Showme||lf||readln('FileID')
  282. end
  283.  
  284. Contd:
  285.  
  286. rtezrequest(" " showme " ","E_xtract|_Edit|_About|_To List|_Next","Trade Tool V1.1 By Side\X/inder of LSD", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  287. if rtresult = 1 then signal ext
  288. if rtresult = 2 then signal edit
  289. if rtresult = 3 then signal about
  290. if rtresult = 4 then signal filelist
  291. if rtresult = 0 then exit
  292. end
  293.  
  294. EDIT:
  295.  
  296. address command 'DMSDESCRIPT x ram:t/FILE_ID.diz ' ||file
  297. address command 'copy ram:t/FILE_ID.diz ram:'
  298. dopus back
  299. address command 'ED ram:FILE_ID.diz '
  300. dopus front
  301. call rtezrequest("Repack your New File Id ?.","_OK|_Cancel","Trade Tool V1.1 By Side\X/inder of LSD ","RT_ReqPos=ReqPos_CenterScr rt_PubScrName = "DOPUS.1)
  302. if rtresult = 1 then signal dmspack
  303. if rtresult = 0 then exit
  304. end
  305.  
  306. dmspack:
  307.  
  308. address command 'DMSDESCRIPT d ' ||file
  309. address command 'DMSDESCRIPT a ram:FILE_ID.diz ' ||file
  310. address command 'delete ram:file_id.diz'
  311. exit
  312. end
  313.  
  314. EXT:
  315.  
  316. rtezrequest("Insert disk in drive and then select "lf" destination for" dmsname".","DF0:|DF1:|FF0:|FF1:|FF2:|FF3:|FF4:|RAD:|_Exit","Dms Extraction", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  317. if rtresult = 1 then do
  318. Dest='DF0:'
  319. signal dmsw
  320. end
  321. if rtresult = 2 then do
  322. Dest='DF1:'
  323. signal dmsw
  324. end
  325. if rtresult = 3 then do
  326. Dest='FF0:'
  327. signal dmsw
  328. end
  329. if rtresult = 4 then do
  330. Dest='FF1:'
  331. signal dmsw
  332. end
  333. if rtresult = 5 then do
  334. Dest='FF2:'
  335. signal dmsw
  336. end
  337. if rtresult = 6 then do
  338. Dest='FF3:'
  339. signal dmsw
  340. end
  341. if rtresult = 7 then do
  342. Dest='FF4:'
  343. signal dmsw
  344. end
  345. if rtresult = 8 then do
  346. Dest='RAD:'
  347. signal dmsw
  348. end
  349. if rtresult = 0 then
  350. exit
  351. end
  352.  
  353. dmsw:
  354.  
  355. lister new
  356. handle=result
  357.  
  358. lister set handle busy on
  359. lister set handle path dest
  360. lister set handle progress 80 'Unpacking' dmsname'...'
  361.  
  362. address command 'C:Mount' dest
  363. address command 'Run >NIL: <NIL: DMS <NIL: >PIPE:dmsout WRITE' file 'TO' dest 'NOVERIFY NOTEXT'
  364. address command 'Status >T:ProcessNo COMMAND DMS'
  365. call open('temp','T:ProcessNo','r')
  366. process=readln('temp')
  367. close('temp')
  368. address command 'Delete >NIL: T:ProcessNo QUIET'
  369.  
  370. nomessage=1
  371. errorreport=''
  372. buffer=''
  373. call open('dmsout','PIPE:dmsout','r')    /* output from DMS comes through PIPE: */
  374.  
  375. do until eof('dmsout')
  376.    buffer=buffer||readch('dmsout',25)    /* read portions of 25 characters */
  377.    here=verify(buffer,'0a0d'x,'m')    /* check for new lines */
  378.    if here>0 then do
  379.       line=left(buffer,here-1)        /* one whole line */
  380.       if nomessage&left(line,7)='No Disk' then do
  381.          lister set handle progress name 'Insert disk in' dest
  382.          nomessage=0
  383.          end
  384.       parse var line ' ' line        /* get rid of some ugly stuff */
  385.       buffer=substr(buffer,here+1)
  386.       if pos('ERROR',upper(line))>0 then do
  387.          errorreport=errorreport||lf||line
  388.          say '07'x            /* beep the display */
  389.          end
  390.       if pos('unPacking',line)>0 then do
  391.          track=right(line,2)
  392.          lister set handle progress count track+1
  393.          lister set handle progress name 'Track' track
  394.          lister query handle abort
  395.          if result then do
  396.             address command 'Break' process 'C'
  397.             lister set handle busy off
  398.             lister set handle title 'UnDMS aborted...'
  399.             exit
  400.             end
  401.          end
  402.       end
  403.    end
  404.  
  405. call close('dmsout')
  406.  
  407. if errorreport~=='' then
  408.    dopus request '"The Error Report For You '||lf||errorreport'" OK'
  409.  
  410. lister set handle busy off
  411. lister read handle dest force
  412. exit
  413. end
  414.  
  415. /* ----------------------------------------------------------------------- */
  416.  
  417. TXT:
  418.  
  419. cuthere=lastpos('/',file)
  420. if cuthere=0 then
  421.    cuthere=pos(':',file)
  422. txtname="'"substr(file,cuthere+1)"'"
  423.  
  424. fileidt:
  425.  
  426. if exists('T:FILE_ID.DIZ')then address command 'delete T:FILE_ID.DIZ quiet'
  427. ADDRESS command 'C:TxtExtract e > NIL: T:FILE_ID.DIZ '||file
  428. if ~exists('T:FILE_ID.DIZ')then signal contt
  429. Showme=""
  430. call open('FileID','T:FILE_ID.diz','r')
  431. do until eof('FileID')
  432. Showme=Showme||lf||readln('FileID')
  433. end
  434.  
  435. contt:
  436.  
  437. rtezrequest(" " showme " ","_Read|_Edit|_About|_To List|_Next","Trade Tool V1.1 By Side\X/inder of LSD", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  438. if rtresult = 1 then signal read
  439. if rtresult = 2 then signal tedit
  440. if rtresult = 3 then signal about
  441. if rtresult = 4 then signal filelist
  442. if rtresult = 0 then exit
  443. end
  444.  
  445. TEDIT:
  446.  
  447. dopus request "'Not yet implemented'" OK
  448.  
  449. exit
  450. end
  451.  
  452. read:
  453.  
  454. address Command 'SYS:Utilities/multiview SCREEN' file
  455. exit
  456. end
  457.  
  458. /* ----------------------------------------------------------------------- */
  459.  
  460. EXE:
  461.  
  462. cuthere=lastpos('/',file)
  463. if cuthere=0 then
  464.    cuthere=pos(':',file)
  465. exename="'"substr(file,cuthere+1)"'"
  466.  
  467. if exists('T:FILE_ID.DIZ')then address command 'delete T:FILE_ID.DIZ quiet'
  468. ADDRESS command 'EXEDescript x > NIL: T:FILE_ID.DIZ '||File
  469.    if ~exists('T:FILE_ID.DIZ')then signal ContEx
  470. Showme=""
  471. call open('FileID','T:FILE_ID.diz','r')
  472. do until eof('FileID')
  473. Showme=Showme||lf||readln('FileID')
  474. end
  475.  
  476. Contex:
  477.  
  478. rtezrequest(" " showme " ","_Edit|_About|_To List|_Next","Trade Tool V1.1 By Side\X/inder of LSD", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  479.  
  480. if rtresult = 1 then signal exedit
  481. if rtresult = 2 then signal about
  482. if rtresult = 3 then signal filelist
  483. if rtresult = 0 then exit
  484. end
  485.  
  486. EXEDIT:
  487.  
  488. address command 'EXEDESCRIPT x ram:t/FILE_ID.diz ' ||file
  489. address command 'copy ram:t/FILE_ID.diz ram:'
  490. address command 'ED ram:FILE_ID.diz '
  491. address command 'EXEDESCRIPT d ' ||file
  492. address command 'EXEDESCRIPT a ram:FILE_ID.diz ' ||file
  493. address command 'delete ram:file_id.diz'
  494. exit
  495. end
  496.  
  497. /***********************************************************/
  498.  
  499. GIF:
  500.  
  501. cuthere=lastpos('/',file)
  502. if cuthere=0 then
  503.    cuthere=pos(':',file)
  504.    gifname="'"substr(file,cuthere+1)"'"
  505.    
  506. if exists('T:FILE_ID.DIZ')then address command 'delete T:FILE_ID.DIZ quiet'
  507. ADDRESS command 'GifDesc e > NIL: '||File||' T:FILE_ID.DIZ '
  508. if ~exists('T:FILE_ID.DIZ')then signal ContGif
  509. Showme=""
  510. call open('FileID','T:FILE_ID.diz','r')
  511. do until eof('FileID')
  512. Showme=Showme||lf||readln('FileID')
  513. end
  514.       
  515. ContGif:
  516.  
  517. rtezrequest(" " showme " ","_Edit|_About|_Next","Trade Tool V1.1 By Side\X/inder of LSD", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)      
  518.  
  519. if rtresult = 1 then signal gifedit
  520. if rtresult = 2 then signal about
  521. if rtresult = 0 then exit
  522. end
  523.  
  524. GifEDIT:
  525.  
  526. address command 'GIFDESC e > NIL: '||File||' ram:t/FILE_ID.diz '
  527. address command 'copy ram:t/FILE_ID.diz ram:'
  528. dopus back
  529. address command 'ED ram:FILE_ID.diz '
  530. dopus front
  531. address command 'GifDESC d ' ||file
  532. address command 'GifDESC a > NIL: '||File||' ram:FILE_ID.diz '
  533. address command 'delete ram:file_id.diz'
  534. exit
  535. end      
  536.  
  537. Fail:
  538.  
  539. call rtezrequest("You Failed To Pick A Destination Directory.", "_Exit", ,"RT_ReqPos=ReqPos_CenterScr rt_PubScrName = "DOPUS.1)
  540. exit
  541. end
  542.  
  543. about:
  544.  
  545. call close('FileID')
  546. Call rtezrequest("Trade Tool V1.1 was created by Side\X/inder of LSD on 8th June 1995."lf""lf"For more information and all the latest filez,call"lf""lf"CEMENT CITY-TANGOLAND-13th HOUR","_Quit|_Exit","Trade Tool V1.1 by Side\X/inder of LSD","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="DOPUS.1)
  547. if RTResult = 1 then signal quit
  548. if rtresult = 0 then signal start
  549. end
  550.  
  551.