home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / vtdicons.cmd < prev    next >
OS/2 REXX Batch file  |  1997-01-26  |  11KB  |  329 lines

  1. /*****************************************************************************/
  2. /* VTDICONS.CMD                                                              */
  3. /* Create desktop Icons for VTD for OS/2 and each Users present Statistics,  */ 
  4. /* except for SIP                                                            */
  5. /* Origianlly creator:  Frank Adams      -  October 25, 1994                 */
  6. /* Enhancements by:     Dharmesh Bhakta  -  March 15, 1994                   */
  7. /*****************************************************************************/ 
  8.  
  9. Trace '0'
  10. Address CMD
  11. '@ECHO OFF'
  12. Signal On Halt
  13. Signal On Syntax
  14.  
  15. /**************/
  16. /* Initialize */
  17. /**************/
  18. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  19. Call SysLoadFuncs
  20.  
  21. /***********************/
  22. /* Display Header info */
  23. /***********************/
  24.  
  25. cls
  26. Say '          IBM VoiceType Dictation System Folder & Icon creator '
  27. Say ' '
  28. Say '    This REXX program will recreate the IBM VoiceType Dictation System folder'
  29. Say 'and all of the icons within.  Once the standard icons have been created,' 
  30. Say 'you will be asked if you would like to recreate all of the User icons.'
  31. Say 'If you choose to continue, you have the option of recreating icons for each'
  32. Say "user that has enrolled or installed his or her's speaker model statistics"
  33. Say 'on this system.  Also, as an added bonus, this program will prompt you'
  34. Say 'before creating icons for each vocabulary for each user.  For example, if'
  35. Say 'you also have the Radiology vocabulary installed along with the standard'
  36. Say 'vocabulary that comes with the product, this program will create icons'
  37. Say 'for each vocabulary for you.  Thus, you should have two icons in your IBM'
  38. Say 'VoiceType Dictation System folder that will automatically start the vocabulary'
  39. Say 'of your choice.'
  40. Say ' ' 
  41. 'PAUSE'
  42.  
  43. /***********************/ 
  44. /* Verify REXX version */ 
  45. /***********************/ 
  46. Parse Version v 
  47. v = Translate(Word(v,5)||Right(Wordpos(Word(v,4),'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'),2)||Right(Word(v,3),2),'0',' ')
  48. If v < 19920708 Then Do
  49.   Say "The version of REXX on your system is backlevel."
  50.   Say " "
  51.   Say "Please update your REXX level code to version 2.0."
  52.   Say "To end this process, kill the OS/2 session.  If you wish to continue"
  53.   Say "then press any other key.  Your icons may not be created beacuse of"
  54.   Say "this back level code!"
  55.   'PAUSE'
  56. End
  57.  
  58. /*****************************/
  59. /* Get TangLite Drive Letter */
  60. /*****************************/
  61.  
  62. SPCH_DRV = value('SPCH_DRIVE',,'OS2ENVIRONMENT')
  63.  
  64. /**********************************/
  65. /* CREATE TANGLITE FOLDER & ICONS */
  66. /**********************************/
  67. cls
  68. /**************************************************/
  69. /** CREATE "IBM Personal Dictation System" FOLDER */
  70. /**************************************************/
  71. thing      = 'IBM VoiceType Dictation System folder'
  72. classname  = 'WPFolder'
  73. title      = 'IBM VoiceType Dictation System'
  74. location   = '<WP_DESKTOP>'
  75. setup      = 'OBJECTID=<TANGLITE>;'||,
  76.              'ICONFILE='SPCH_DRV'\SPCH_RO\BIN\IPDS_US.ICO;'
  77. result     = SysCreateObject(classname, title, location, setup, 'r') 
  78. Call Check_Result
  79.  
  80. /**************************************/
  81. /** CREATE "Check Installation" ICON **/
  82. /**************************************/
  83. thing      = 'Check Installation icon'
  84. classname  = 'WPProgram'
  85. title      = 'Check Installation'
  86. location   = '<TANGLITE>'
  87. setup      = 'OBJECTID=<CHKINST>;'||, 
  88.              'EXENAME='SPCH_DRV'\SPCH_RO\BIN\CHKINST.EXE;'||, 
  89.              'PARAMETERS=-l En_US -u sip -e isob571 -d walkupus;'||,
  90.              'STARTUPDIR='SPCH_DRV'\SPCH_RUN;'||, 
  91.              'PROGTYPE=PM;'
  92. result     = SysCreateObject(classname, title, location, setup, 'r') 
  93. Call Check_Result
  94.  
  95. /****************************/
  96. /** CREATE "Tutorial" ICON **/
  97. /****************************/
  98. thing      = 'Tutorial icon' 
  99. classname  = 'WPProgram'
  100. title      = 'Tutorial'
  101. location   = '<TANGLITE>'
  102. setup      = 'OBJECTID=<SPTUTOR>;'||,
  103.              'EXENAME='SPCH_DRV'\SPCH_RO\BIN\SPTUTOR.EXE;'||, 
  104.              'PARAMETERS=-L En_US;'||,
  105.              'STARTUPDIR='SPCH_DRV'\SPCH_RUN;'||,
  106.              'PROGTYPE=PM;'
  107. result     = SysCreateObject(classname, title, location, setup, 'r') 
  108. Call Check_Result
  109.  
  110. /*******************************/
  111. /** CREATE "Speech Games" ICON */
  112. /*******************************/
  113. thing      = 'Speech Games icon'
  114. classname  = 'WPProgram'
  115. title      = 'Speech Games'
  116. location   = '<TANGLITE>'
  117. setup      = 'OBJECTID=<GAMES>;'||,
  118.              'EXENAME='SPCH_DRV'\SPCH_RO\BIN\GAMES.EXE;'||, 
  119.              'STARTUPDIR='SPCH_DRV'\SPCH_RUN;'||,
  120.              'PROGTYPE=PM;'
  121. result     = SysCreateObject(classname, title, location, setup, 'r') 
  122. Call Check_Result
  123.  
  124. /*****************************/
  125. /** CREATE "Enrollment" ICON */
  126. /*****************************/
  127. thing      = 'Enrollment icon'
  128. classname  = 'WPProgram'
  129. title      = 'Enrollment'
  130. location   = '<TANGLITE>'
  131. setup      = 'OBJECTID=<ENROLL>;'||,
  132.              'EXENAME='SPCH_DRV'\SPCH_RO\BIN\ENROLL.EXE;'||, 
  133.              'PARAMETERS=-L En_US;'||,
  134.              'STARTUPDIR='SPCH_DRV'\SPCH_RUN;'||,
  135.              'PROGTYPE=PM;'
  136. result     = SysCreateObject(classname, title, location, setup, 'r') 
  137. Call Check_Result
  138.  
  139. /*****************************************/
  140. /** CREATE "Voice Manager Settings" ICON */
  141. /*****************************************/
  142. thing      = 'Voice Manager Settings icon'
  143. classname  = 'SPEECHWP'
  144. title      = 'Voice Manager^Settings'
  145. location   = '<WP_DESKTOP>'
  146. setup      = 'OBJECTID=<SMAUDIO>;'
  147. result     = SysCreateObject(classname, title, location, setup, 'r') 
  148. Call Check_Result
  149.  
  150. 'PAUSE'
  151.  
  152. /****************************/
  153. /* Check for Speaker Models */
  154. /****************************/
  155.  
  156. call SysFileTree SPCH_DRV'\spch_rw\users\*.*', 'users', 'D'
  157. if users.0 = 0 then do
  158.    say "There appears to be no user statistics installed." users.0
  159.    exit(-1)
  160. end  /* Do */
  161.  
  162. call SysFileTree SPCH_DRV'\spch_ro\langs\En_US\tasks\*.*', 'domains', 'D'
  163. if domains.0 = 0 then do
  164.    say "There appears to be no domains (vocabularies) installed." domains.0
  165.    exit(-1)
  166. end  /* Do */
  167.  
  168.  
  169. /************************************/
  170. /* Prompt User to create User Icons */
  171. /************************************/
  172.  
  173. cls
  174. Say 'Would you like for me to recreate all of the User Icons (Y/N)'
  175.   pull answer
  176. if answer = "Y" | answer = "y" then do
  177.     exist=stream(SPCH_DRV'\SPCH_RO\BIN\SMARTMIC.ICO','c','query exists')
  178.     if exists = "" then do
  179.       say SPCH_DRV'\SPCH_RO\BIN\SMARTMIC.ICO' 'icon not found.'
  180.     exit(-2)
  181.     end  /* Do */
  182.  
  183.     do i=1 to users.0 by 1
  184.        parse var users.i . . . . dirspec .
  185.        dir_name=filespec('name',dirspec)
  186.        if translate(dir_name) <> 'SIP' then do
  187.          objectid = "TANGLITE"||i
  188.          call SysFileTree dirspec"\*.uid", 'uid', 'F'
  189.          if uid.0 = 0 | uid.0 > 1 then do
  190.             say "There is either no *.uid or more than one *.uid file, exit." uid.0
  191.             exit(-3)
  192.          end  /* Do */
  193.          parse var uid.1 . . . . uid_file .
  194.          do until lines(uid_file) = 0
  195.             cur_line=linein(uid_file)
  196.             parse var cur_line name equal full_name
  197.             if substr(name,2) = "Name" then leave /*get rid of weird x'09' */
  198.          end  /* do until uid eof */
  199.          call SysFileTree dirspec"\*.eid", 'eid', 'F'
  200.          if eid.0 = 0 | eid.0 > 1 then do
  201.             say "There is either no *.eid or more than one *.eid file, exit." eid.0
  202.             exit(-3)
  203.          end  /* Do */
  204.          parse var eid.1 . . . . eid_file .
  205.          eid_name=filespec('name',eid_file)
  206.          parse var eid_name enroll_id '.' .
  207.  
  208.          cls
  209.          new_domain = ''
  210.          Title    =full_name 
  211.          SETUP1   ='OBJECTID=<'objectid'>;EXENAME='SPCH_DRV'\SPCH_RO\BIN\WW.EXE;'
  212.          SETUP3   ='PARAMETERS=-d startus -e 'enroll_id '-u 'dir_name '-L En_US;'
  213.          call User_Icon 
  214.  
  215.          parse var domains.i . . . . dirspec .
  216.          dir_name=filespec('name',dirspec)
  217.          call SysFileTree dirspec"\*.tid", 'tid', 'F'
  218.  
  219.          do x=1 to tid.0 by 1
  220.             parse var tid.x . . . . tid_file
  221.             vocab_name=filespec('name',tid_file)
  222.             parse var vocab_name domain '.' .
  223.             objectid = full_name domain
  224.  
  225.             if domain \= "enroll" ^ domain \= "startus" ^ domain \= "walkup" then do
  226.               call Real_Domains 
  227.               Say ' '
  228.               Say "Would you like "full_name"'s "new_domain" vocabulary icon created (y/n)?"
  229.               pull answer2
  230.  
  231.               if answer2 = "Y" | answer2 = 'y' then do
  232.                 Title    =full_name||'0a'x||new_domain 
  233.                 SETUP1   ='OBJECTID=<'objectid'>;EXENAME='SPCH_DRV'\SPCH_RO\BIN\WW.EXE;'
  234.                 SETUP3   ='PARAMETERS=-d 'domain' -e 'enroll_id '-u 'dir_name '-L En_US;'
  235.                 call User_Icon
  236.               end /* end do answer2 */
  237.               domain = ''
  238.               Say ' ' 
  239.             end /* end do domain */ 
  240.          end /* end do x */
  241.          'PAUSE'
  242.        end  /* Do if dir_name  */
  243.     end /* do users.i*/
  244. end
  245. else
  246.   call Endit
  247.  
  248.  
  249. /****************/
  250. /* EXIT PROGRAM */
  251. /****************/
  252. Endit:
  253.   do
  254.     cls
  255.     Say "Thanks for using TANGICON.CMD!   Have a Grrrreeaaatt DAY!!"
  256.     Say " "
  257.   end
  258. Exit 0
  259.  
  260.  
  261. /*********************/
  262. /* CREATE USER_ICONS */
  263. /*********************/
  264. User_Icon:
  265.    ClassName='WPProgram'
  266.    Location ='<TANGLITE>'
  267.    SETUP2   ='STARTUPDIR='SPCH_DRV'\SPCH_RUN;'
  268.    SETUP4   ='ICONFILE='SPCH_DRV'\SPCH_RO\BIN\SMARTMIC.ICO;'
  269.                                                                                 
  270.    RC=SysCreateObject(ClassName,Title,Location,SETUP1||SETUP2||SETUP3||SETUP4,'R')
  271.    IF RC <> 1 THEN 
  272.       Say 'Speaker Model icon "'full_name new_domain'" already exists!  Sorry not created!'
  273.    ELSE 
  274.       Say 'Speaker Model icon "'full_name new_domain'" created successfully!' 
  275.    return
  276.  
  277.  
  278. /*******************/
  279. /* INFORM THE USER */ 
  280. /*******************/
  281.  
  282. Check_Result:
  283.    If result = 1 then do
  284.       Say 'The 'thing' has been created successfully!'
  285.       Say ' '
  286.       END
  287.    else do 
  288.       Say 'The 'thing' already exists!  Sorry not created!'
  289.       Say ' '
  290.       End
  291.    return 
  292.  
  293. /***************************/
  294. /* ASSIGN REAL VOCAB NAMES */
  295. /***************************/
  296. Real_Domains:
  297.    if domain = 'rad' then new_domain = 'Radiology'
  298.    if domain = 'news' then new_domain = 'Journalism'
  299.    if domain = 'em' then new_domain = 'Emergency Medicine'
  300.    return
  301.  
  302.  
  303. /*************************/
  304. /* HANDLE SIGNAL ON HALT */
  305. /*************************/
  306. Halt:
  307. Say 'A Halt condition was raised on line' sig1'!'
  308. problem_line = sigl
  309. Signal Abnormal_End
  310.  
  311. /***************************/
  312. /* HANDLE SIGNAL ON SYNTAX */
  313. /***************************/
  314. Syntax:
  315. Say 'A SYNTAX condition was raised on line' sigl'!'
  316. Say '  The error number is' rc', which means "'Errortext(rc)'"'
  317. problem_line=sigl
  318. Signal Abnormal_End
  319.  
  320. /****************/
  321. /* Abnormal End */
  322. /****************/
  323. Abnormal_End:
  324. Say '   That line is "'Sourceline(problem_line)'"'
  325. Exit  
  326.                  
  327. (C) Copyright IBM Corp.  1993
  328.  
  329.