home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / misc / FetchRefs1.3.lha / FetchRefs1.3 / Scripts / FPL / GoFetchRefs.FPL
Encoding:
Text File  |  1995-02-14  |  2.4 KB  |  108 lines

  1. /* $VER: GoFetchRefs.FPL 1.1 (13.2.95)
  2.  *
  3.  * - Enables you to use the FetchRefs program by Anders Melchiorsen.
  4.  *
  5.  * Made by Mogens Isager (2:235/419.9@fidonet)
  6.  *
  7.  */
  8.  
  9.  
  10. export void FetchRefsPrefs()
  11. {
  12.     PromptInfo(-1, "FetchRefs preferences", -1, -1,
  13.         "FetchRefs_Path",
  14.         "FetchRefs_Index",
  15.         "FetchRefs_Arexx"
  16.         );
  17. }
  18.  
  19. export void FetchRefsLoaded()
  20. {
  21.     if ( FindPort("FETCHREFS") )
  22.     {
  23.         FetchRefs();
  24.     }
  25.     else
  26.     {
  27.         if ( System( sprintf( "Run <>nil: %sFetchRefs FILES=%s", ReadInfo("FetchRefs_Path"), ReadInfo("FetchRefs_Index") ) ) == 0)
  28.         {
  29.             FetchRefs();
  30.         }
  31.         else
  32.         {
  33.             Request("Sorry, could not load FetchRefs.\nCheck the FetchRefs_Path info variabel", "GoFetchRefs Information", "Damn!");
  34.         }
  35.     }
  36. }    
  37.  
  38.  
  39. export void FetchRefs()
  40. {
  41.     int id, result;
  42.     string filename = "T:FetchedReference";
  43.     string word, jones;
  44.  
  45.     word = GetWord();
  46.  
  47.     if ( strcmp( "TagList", substr( word, strlen(word) - 7, 7) ) == 0 )
  48.         word = substr( word, 0, strlen(word) - 7);
  49.  
  50.     if ( strcmp( "Tags", substr( word, strlen(word) - 4, 4) ) == 0 )
  51.         word = substr( word, 0, strlen(word) - 4);
  52.  
  53.     if ( strcmp( "A", substr( word, strlen(word) - 1, 1) ) == 0 )
  54.         word = substr( word, 0, strlen(word) - 1);
  55.  
  56.     result = System( sprintf( "RX %sGoFetchRefs.frexxed %s %s", ReadInfo("FetchRefs_Arexx"), word, filename) );
  57.  
  58.     if ( result == 0 )
  59.     {
  60.         int views = ReadInfo("views");
  61.         int line, result;
  62.         string errstr, resultstring = LoadString( "T:FetchRefsResult" );
  63.  
  64.         interpret( resultstring );
  65.  
  66.         if ( result != 10 )
  67.         {
  68.             while (views > 0)
  69.             {
  70.                 string file;
  71.  
  72.                 file = ReadInfo("file_name");
  73.  
  74.                 if ( Stricmp( file, "FetchedReference", 10) == 0 )
  75.                     views = -1;
  76.                 else
  77.                 {
  78.                     views = views - 1;
  79.                     id = NextView();
  80.                     Activate(id, 0);
  81.                     CurrentBuffer(id);
  82.                 }
  83.             }
  84.  
  85.             if ( views == 0 )
  86.             {
  87.                 id = New();
  88.                 Activate(id);
  89.                 CurrentBuffer(id);
  90.             }
  91.             Load("T:FetchedReference");
  92.             GotoLine( line );
  93.         }
  94.         System("Delete >nil: T:FetchedReference T:FetchRefsResult");
  95.     }
  96.     else
  97.     {
  98.         Request("Sorry, could not find the Arexx script.\nCheck the FetchRefs_Arexx info variabel.", "GoFetchRefs Information", "Damn!");
  99.     }
  100. }
  101.  
  102. AssignKey("FetchRefs();", "control f control f");
  103. AssignKey("FetchRefsPrefs();", "control f control p");
  104.  
  105. ConstructInfo("FetchRefs_Path", "", "", "LSW", "", 0, 0, "SYS:Tools/");
  106. ConstructInfo("FetchRefs_Index", "", "", "LSW", "", 0, 0, "S:FetchRefs.index");
  107. ConstructInfo("FetchRefs_Arexx", "", "", "LSW", "", 0, 0, "REXX:");
  108.