home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / mmfix11.zip / MMDEREG.CMD next >
OS/2 REXX Batch file  |  1997-09-15  |  14KB  |  546 lines

  1. /*********************************************************************/
  2. /*                                                                   */
  3. /*  MMDEREG.CMD - version 1.1                                        */
  4. /*  Copyright (C) R L Walsh 1997 - All Rights Reserved               */
  5. /*                                                                   */
  6. /*  email the author at rlwalsh@packet.net                           */
  7. /*                                                                   */
  8. /*********************************************************************/
  9.  
  10. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  11. call SysLoadFuncs
  12. call RxFuncAdd 'RxWinReplaceObjectClass', 'mmparts', 'RxWinReplaceObjectClass'
  13.  
  14. say ''
  15. say ' **********************************************************'
  16. say ' *  MMDEREG.CMD - version 1.1                             *'
  17. say ' *  Copyright (C) R L Walsh 1997 - All Rights Reserved    *'
  18. say ' *                                                        *'
  19. say ' *  email the author at rlwalsh@packet.net                *'
  20. say ' **********************************************************'
  21. say ''
  22. say ''
  23. say ' MMDEREG shows info about the WPS Multimedia classes'
  24. say ' and lets you deregister / reregister them.'
  25. say ' Deregistration is NOT effective unless you have run'
  26. say ' MMFIX.CMD to patch MMPARTS.DLL.'
  27. say ''
  28. say ' Do you want to continue?  If yes, press "Y" then "Enter"'
  29.  
  30. pull answer
  31. if left( strip(answer), 1) \= 'Y' then
  32.     do
  33.        say ' Quitting MMDEREG...'
  34.        exit
  35.     end
  36.  
  37. call DisplayMainMenu
  38.  
  39. do forever
  40.     pull answer
  41.     answer = left( strip(answer), 1)
  42.  
  43.     select
  44.         when answer = 1 then
  45.             call AudioProc
  46.  
  47.         when answer = 2 then
  48.             call VideoProc
  49.  
  50.         when answer = 3 then
  51.             call ImageProc
  52.  
  53.         when answer = 4 then
  54.             call MiscProc
  55.  
  56.         when answer = 5 then
  57.             call ListProc
  58.  
  59.         when answer = 'Q' then
  60.             do
  61.                 say 'Quitting MMDEREG...'
  62.                 exit
  63.             end
  64.  
  65.         otherwise
  66.             nop
  67.  
  68.     end /* end select */
  69.  
  70.     call DisplayMainMenu
  71.  
  72. end /* do forever */
  73.  
  74.  
  75. /*********************************************************************/
  76.  
  77. DisplayMainMenu: procedure
  78.  
  79. call SysCls
  80. say ''
  81. say '       WPS Multimedia Classes'
  82. say ''
  83. say ''
  84. say '   1 - Audio classes (WAV, MIDI, etc.)'
  85. say '   2 - Video classes (FLI, MPEG, etc.)'
  86. say '   3 - Image classes (BMP, JPEG, etc.)'
  87. say '   4 - Miscellaneous (LightTable, devices, etc.)'
  88. say '   5 - List all Multimedia classes'
  89. say '   Q - Quit'
  90. say ''
  91. say ''
  92. say '  Choose an option, then press "Enter"'
  93. say '  (You will return to this screen when done)'
  94. say ''
  95.  
  96. return
  97.  
  98. /*********************************************************************/
  99.  
  100. AudioProc: procedure
  101.  
  102. class. = ''
  103. class.0 = '9'
  104. class.1 = 'MMMIDI'
  105. class.2 = 'MMAIF'
  106. class.3 = 'MMAU'
  107. class.4 = 'MMIFF'
  108. class.5 = 'MMSNDF'
  109. class.6 = 'MMVOC'
  110. class.7 = 'MMWAV'
  111. class.8 = 'MM_AU'
  112. class.9 = 'MMAudio'
  113.  
  114. do forever
  115.  
  116. drop status
  117. status. = ''
  118. call SysCls
  119. call GetRegClasses
  120.  
  121. say ''
  122. say 'Audio Classes'
  123. say '                    associated with these'
  124. say 'Nbr  Class   Reg  Extensions     File Types'
  125. say '---  ------  ---  ---------      ----------'
  126. say ' 1   MMMIDI   'left(status.1,1)'    (none)         (none)'
  127. say ' 2   MMAIF    'left(status.2,1)'    *.AIF          AIF'
  128. say ' 3   MMAU     'left(status.3,1)'    *.AU           AU'
  129. say ' 4   MMIFF    'left(status.4,1)'    *.IFF          IFF'
  130. say ' 5   MMSNDF   'left(status.5,1)'    *.SND          SND'
  131. say ' 6   MMVOC    'left(status.6,1)'    *.VOC          VOC'
  132. say ' 7   MMWAV    'left(status.7,1)'    *.WAV          WAV, Digital Audio'
  133. say ' 8   MM_AU    'left(status.8,1)'    *._AU          _AU'
  134. say ' 9   MMAudio  'left(status.9,1)'    (parent of classes 2-8)'
  135. say ''
  136. say 'Do not deregister MMAudio unless you also'
  137. say 'deregister all of classes 2-8'
  138. say ''
  139. say 'Enter the numbers of the classes you want to register'
  140. say 'and deregister, separated by spaces (e.g. "2 4 6").'
  141. say 'Then press "Enter". Leave blank to return to the Main menu.'
  142.  
  143. if GetChoices() then
  144.     return
  145.  
  146. end
  147.  
  148. return
  149.  
  150. /*********************************************************************/
  151.  
  152. VideoProc: procedure
  153.  
  154. class. = ''
  155. class.0 = '5'
  156. class.1 = 'MMAVI'
  157. class.2 = 'MMFLI'
  158. class.3 = 'MMMOV'
  159. class.4 = 'MMMPG'
  160. class.5 = 'MMVideo'
  161.  
  162. do forever
  163.  
  164. drop status
  165. status. = ''
  166. call SysCls
  167. call GetRegClasses
  168.  
  169. say ''
  170. say 'Video Classes'
  171. say '                    associated with these'
  172. say 'Nbr  Class   Reg  Extensions      File Types'
  173. say '---  ------  ---  -----------     -------------'
  174. say ' 1   MMAVI    'left(status.1,1)'   *.AVI           AVI, Digital Video'
  175. say ' 2   MMFLI    'left(status.2,1)'   *.FLI,*.FLC     FLC/FLI'
  176. say ' 3   MMMOV    'left(status.3,1)'   *.MOV,*.QT      QuickTime Movie'
  177. say ' 4   MMMPG    'left(status.4,1)'   *.MPG,*.VBS     MPEG'
  178. say ' 5   MMVideo  'left(status.5,1)'   (parent of classes 1-4)'
  179. say ''
  180. say 'Do not deregister MMVideo unless you also'
  181. say 'deregister all of classes 1-4'
  182. say ''
  183. say 'Enter the numbers of the classes you want to register'
  184. say 'and deregister, separated by spaces (e.g. "2 4 6").'
  185. say 'Then press "Enter". Leave blank to return to the Main menu.'
  186.  
  187. if GetChoices() then
  188.     return
  189.  
  190. end
  191.  
  192. return
  193.  
  194. /*********************************************************************/
  195.  
  196. ImageProc: procedure
  197.  
  198. class. = ''
  199. class.0 = '11'
  200. class.1 = 'MMBitmap'
  201. class.2 = 'MMAVC'
  202. class.3 = 'MMDIB'
  203. class.4 = 'MMGIF'
  204. class.5 = 'MMJPG'
  205. class.6 = 'MMMMotion'
  206. class.7 = 'MMPCX'
  207. class.8 = 'MMPhotoCD'
  208. class.9 = 'MMTIFF'
  209. class.10 = 'MMTarga'
  210. class.11 = 'MMImage'
  211.  
  212. do forever
  213.  
  214. drop status
  215. status. = ''
  216. call SysCls
  217. call GetRegClasses
  218.  
  219. say ''
  220. say 'Image Classes'
  221. say '                      associated with these'
  222. say 'Nbr  Class     Reg  Extensions      File Types'
  223. say '---  ------    ---  ----------      ----------'
  224. say ' 1   MMBitmap   'left(status.1,1)'     *.BMP          Bitmap'
  225. say ' 2   MMAVC      'left(status.2,1)'     *._IM          AVC Image'
  226. say ' 3   MMDIB      'left(status.3,1)'     *.DIB          DIB'
  227. say ' 4   MMGIF      'left(status.4,1)'     *.GIF          GIF'
  228. say ' 5   MMJPG      'left(status.5,1)'     *.JPG          JPG'
  229. say ' 6   MMMMotion  'left(status.6,1)'     *.VID          MMotion Image'
  230. say ' 7   MMPCX      'left(status.7,1)'     *.PCX          PCX'
  231. say ' 8   MMPhotoCD  'left(status.8,1)'     *.PCD          Photo CD'
  232. say ' 9   MMTIFF     'left(status.9,1)'     *.TIF          TIFF'
  233. say '10   MMTarga    'left(status.10,1)'     *.TGA          Targa'
  234. say '11   MMImage    'left(status.11,1)'     (parent of classes 2-10)'
  235. say ''
  236. say 'Do not deregister MMImage unless you also'
  237. say 'deregister all of classes 2-10'
  238. say ''
  239. say 'Enter the numbers of the classes you want to register'
  240. say 'and deregister, separated by spaces (e.g. "2 4 6").'
  241. say 'Then press "Enter". Leave blank to return to the Main menu.'
  242.  
  243. if GetChoices() then
  244.     return
  245.  
  246. end
  247.  
  248. return
  249.  
  250. /*********************************************************************/
  251.  
  252. MiscProc: procedure
  253.  
  254. class. = ''
  255. class.0 = '8'
  256. class.1 = 'MMFolder'
  257. class.2 = 'MMShadow'
  258. class.3 = 'MMVolume'
  259. class.4 = 'MMCDDevice'
  260. class.5 = 'MMLVDDevice'
  261. class.6 = 'MMDevice'
  262. class.7 = 'MMFinder'
  263. class.8 = 'MMDataFile'
  264.  
  265. do forever
  266.  
  267. drop status
  268. status. = ''
  269. call SysCls
  270. call GetRegClasses
  271.  
  272. say ''
  273. say 'Miscellaneous Classes'
  274. say ''
  275. say 'Nbr   Class        Reg   Function'
  276. say '---   -----------  ---   ---------------------'
  277. say ' 1    MMFolder      'left(status.1,1)'    Lighttable folder'
  278. say ' 2    MMShadow      'left(status.2,1)'    Lighttable thumbnails'
  279. say ' 3    MMVolume      'left(status.3,1)'    Volume control'
  280. say ' 4    MMCDDevice    'left(status.4,1)'    Compact Disk'
  281. say ' 5    MMLVDDevice   'left(status.5,1)'    Video Disk (?)'
  282. say ' 6    MMDevice      'left(status.6,1)'    (parent of 4-5)'
  283. say ' 7    MMFinder      'left(status.7,1)'    MM viewer file dialog'
  284. say ' 8    MMDataFile    'left(status.8,1)'    parent of Audio, MIDI,'
  285. say '                         and Video classes'
  286. say ''
  287. say 'Do not deregister MMDevice unless you also deregister classes 4 and 5'
  288. say 'Do not deregister MMDataFile unless you also deregister all of the'
  289. say 'Audio, MIDI, and Video classes'
  290. say ''
  291. say 'Enter the numbers of the classes you want to register'
  292. say 'and deregister, separated by spaces (e.g. "2 4 6").'
  293. say 'Then press "Enter". Leave blank to return to the Main menu.'
  294.  
  295. if GetChoices() then
  296.     return
  297.  
  298. end
  299.  
  300. return
  301.  
  302. /*********************************************************************/
  303.  
  304. GetChoices: procedure expose class. status.
  305.  
  306. rtn = 0
  307. list. = ''
  308. err = ''
  309.  
  310. pull choice answer
  311. if left(strip(choice), 1) = '' then
  312.     return 1
  313.  
  314. do while choice \= ''
  315.     if class.choice = '' then
  316.         err = err choice
  317.     else
  318.         do
  319.             z = 1
  320.             do while list.z \= ''
  321.                 if choice = list.z then
  322.                     leave
  323.                 z = z + 1
  324.             end
  325.  
  326.             if list.z = '' then
  327.                 list.z = choice
  328.             else
  329.                 err = err choice
  330.         end
  331.  
  332.     parse var answer choice answer
  333. end
  334.  
  335. reg = ''
  336. dereg = ''
  337. x = 1
  338.  
  339. do while list.x \= ''
  340.     choice = list.x
  341.     if status.choice = 'r' then
  342.         dereg = dereg class.choice
  343.     else
  344.         reg = reg class.choice
  345.     x = x + 1
  346. end
  347.  
  348. if err \= '' then
  349.     do
  350.         say ''
  351.         say 'These entries were invalid or duplicates: ' err
  352.     end
  353.  
  354. if reg \= '' | dereg \= '' then
  355.     do
  356.         say ''
  357.         if reg \= '' then
  358.             say 'Register: ' reg
  359.         if dereg \= '' then
  360.             say 'Deregister: 'dereg
  361.         say 'Is this correct?  Press "Y" if yes'
  362.  
  363.         pull answer
  364.         if left( strip(answer), 1) = 'Y' then
  365.             call DeReg
  366.     end
  367.  
  368. say ''
  369. say 'Press "Enter" to continue...'
  370. pull ok
  371.  
  372. return rtn
  373.  
  374. /*********************************************************************/
  375.  
  376. Dereg:
  377.  
  378. say ''
  379. say 'Registering / Deregistering classes...'
  380. say ''
  381.  
  382. x = 1
  383.  
  384. do while list.x \= ''
  385.  
  386.     choice = list.x
  387.  
  388.     if status.choice = 'r' then
  389.     do
  390.         replace = ''
  391.         if class.choice = 'MMBitmap' then
  392.                 replace = 'WPBitmap'
  393.         else
  394.         if class.choice = 'MMShadow' then
  395.                 replace = 'WPShadow'
  396.  
  397.         if replace \= '' then
  398.             if RxWinReplaceObjectClass(replace, class.choice, '0') then
  399.                 say class.choice 'unreplaced'
  400.             else
  401.                 say 'Error!  Unable to unreplace' class.choice
  402.  
  403.         if SysDeregisterObjectClass(class.choice) then
  404.             say class.choice 'successfully deregistered'
  405.         else
  406.             say 'Error!  Unable to deregister' class.choice
  407.     end
  408.     else
  409.     do
  410.         dll = 'MMPARTS'
  411.         replace = ''
  412.         if class.choice = 'MMBitmap' then
  413.             do
  414.                 dll = 'MMBIT'
  415.                 replace = 'WPBitmap'
  416.             end
  417.         else
  418.         if class.choice = 'MMShadow' then
  419.             do
  420.                 dll = 'MMSHD'
  421.                 replace = 'WPBitmap'
  422.             end
  423.  
  424.         if SysRegisterObjectClass(class.choice, dll) = FALSE then
  425.             say 'Error!  Unable to register' class.choice
  426.         else
  427.             do
  428.                 say class.choice 'successfully registered'
  429.                 if replace \= '' then
  430.                     if RxWinReplaceObjectClass(replace, class.choice, '1') then
  431.                         say replace 'replaced with' class.choice
  432.                     else
  433.                         say 'Error!  Unable to replace' replace 'with' class.choice
  434.             end
  435.     end
  436.  
  437.     x = x + 1
  438.  
  439. end
  440.  
  441. return
  442.  
  443. /*********************************************************************/
  444.  
  445. ListProc: procedure
  446.  
  447. class. = ''
  448. class.0 = '33'
  449. class.1 = 'MMDataFile'
  450. class.2 = 'MMAudio'
  451. class.3 = 'MMMIDI'
  452. class.4 = 'MMAIF'
  453. class.5 = 'MMAU'
  454. class.6 = 'MMIFF'
  455. class.7 = 'MMSNDF'
  456. class.8 = 'MMVOC'
  457. class.9 = 'MMWAV'
  458. class.10 = 'MM_AU'
  459. class.11 = 'MMVideo'
  460. class.12 = 'MMAVI'
  461. class.13 = 'MMFLI'
  462. class.14 = 'MMMOV'
  463. class.15 = 'MMMPG'
  464. class.16 = 'MMBitmap'
  465. class.17 = 'MMImage'
  466. class.18 = 'MMAVC'
  467. class.19 = 'MMDIB'
  468. class.20 = 'MMGIF'
  469. class.21 = 'MMJPG'
  470. class.22 = 'MMMMotion'
  471. class.23 = 'MMPCX'
  472. class.24 = 'MMPhotoCD'
  473. class.25 = 'MMTIFF'
  474. class.26 = 'MMTarga'
  475. class.27 = 'MMFolder'
  476. class.28 = 'MMShadow'
  477. class.29 = 'MMVolume'
  478. class.30 = 'MMDevice'
  479. class.31 = 'MMCDDevice'
  480. class.32 = 'MMLVDDevice'
  481. class.33 = 'MMFinder'
  482.  
  483.  
  484. drop status
  485. status. = ''
  486. call SysCls
  487. call GetRegClasses
  488.  
  489. say ''
  490. say '          Status of All WPS Multimedia Classes'
  491. say '         (r = Registered, blank = Deregistered)'
  492. say ''
  493.  
  494. i = 1
  495. do while i <= class.0
  496.     j = i + 1
  497.     k = i + 2
  498.     say ' ' left(status.i, 2) left(class.i, 18) left(status.j, 2) left(class.j, 18) left(status.k, 2) class.k
  499.     i = i + 3
  500. end
  501.  
  502. say ''
  503. say ''
  504. say '  Note:  all MM classes are contained in MMPARTS.DLL'
  505. say '         except for MMBitmap which is in MMBIT.DLL,'
  506. say '         and MMShadow which is in MMSHD.DLL'
  507. say ''
  508.  
  509. say '  Press "Enter" to continue...'
  510. pull ok
  511. return
  512.  
  513. /*********************************************************************/
  514.  
  515. GetRegClasses: procedure expose class. status.
  516.  
  517. call SysQueryClassList 'reg.'
  518.  
  519. do i = 1 to reg.0
  520.     parse var reg.i cls dll
  521.     dll = translate(dll)
  522.     if (dll \= 'MMPARTS') & (dll \= 'MMBIT') & (dll \= 'MMSHD') then
  523.         iterate
  524.  
  525.     done = 1
  526.     do j = 1 to class.0
  527.         if status.j = '' then
  528.             do
  529.                 done = 0
  530.                 if class.j = cls then
  531.                     do
  532.                         status.j = 'r'
  533.                         leave
  534.                     end
  535.             end
  536.     end
  537.  
  538.     if done = 1 then
  539.         leave
  540. end
  541.  
  542. return
  543.  
  544. /*********************************************************************/
  545.  
  546.