home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 531.lha / TurboText_Utils / FindDoc / FindAutoDoc.ttx next >
Encoding:
Text File  |  1991-07-04  |  1.7 KB  |  88 lines

  1. /* Autodoc Function Finder */
  2.  
  3. /* Notes:
  4.     1. We need to make sure that the autodoc we want is not already loaded.
  5.         If it is, then we can just go to it.
  6. */
  7.  
  8. OPTIONS RESULTS
  9.  
  10. 'RequestStr prompt "Enter function name  "'
  11.  
  12.     /* Note: from here on down, both FindAutoDoc.ttx and FindAutoDocWord.ttx
  13.         are identical.
  14.     */
  15.  
  16. if (RC > 0) then do
  17.     exit
  18. end
  19. funcname = result
  20.  
  21. hostname = address()
  22. portname = 'Index Finder'
  23.  
  24. if ~show('p',portname) then do
  25.     address COMMAND 'RUN >NIL: <NIL: FindDoc s:autodocs.index s:includes.index'
  26.  
  27.     do i = 1 to 8
  28.         if ~show('p',portname) then do
  29.             address COMMAND 'wait 1'
  30.         end
  31.     end
  32.  
  33.     if ~show('p',portname) then do
  34.         'SetStatusBar "Index Finder port not found!"'
  35.         quit
  36.     end
  37. end
  38.  
  39. address value portname
  40. 'find ('funcname')'
  41. if ~RC then do
  42.     entries = result
  43.  
  44.     address value hostname
  45.  
  46.     if LENGTH(entries) <= 0 then do
  47.         'SetStatusBar "Not Found!"'
  48.         exit                                /* if a NULL line, the do nothing... */
  49.     end
  50.  
  51.     Parse var entries '"' docfile '"' docline . entries
  52.  
  53.     docname = docfile
  54.     lastslash = lastpos(":",docname)
  55.     if lastslash > 0 then do
  56.         docname = substr(docname,lastslash+1)
  57.     end
  58.     lastslash = LastPos("/",docname)
  59.     if lastslash > 0 then do
  60.         docname = substr(docname,lastslash+1)
  61.     end
  62.  
  63.     GetPort name docname
  64.     fileport = RESULT
  65.  
  66.     if (RC > 0) then do                        /* If the source file was not found... */
  67.         OpenDoc name docfile
  68.         fileport = RESULT                    /* get the port                        */
  69.         if RC > 0 then do                    /* if not there, then error            */
  70.             'SetStatusBar "Error: error opening doc file."'
  71.             address command "Wait 6"
  72.             exit
  73.         end
  74.     end
  75.  
  76.     address value fileport
  77.     IconifyWindow OFF
  78.     Window2front
  79.     ActivateWindow
  80.     MoveEOF
  81.     Move docline 0
  82.     exit
  83. end
  84. else do
  85.     address value hostname
  86.     'SetStatusBar "Error: Index Finder Error"'
  87. end
  88.