// This macro fixes the problem with file Search on Windows XP (see below)
// Enter all ASCII (plain text) filetypes that are subject to Search

Requires(20010724); // Requires this build of WinEdt to work properly

  LetReg(0,'%@("HKEY_CLASSES_ROOT",".txt\PersistentHandler"," ")');
  IfStr('%!0','','=',!|LetReg(0,'{5e941d80-bf96-11cd-b579-08002b30bfeb}');|); //Notepad

  // Enter ASCII Filetypes of your choice
  LetReg(3,!'.prj;.edt;.txt;.tex;.ltx;.aux;.bbl;.bib;.blg;.bst;.clo;>
             .cls;.def;.dtx;.drv;.ins;.fdd;.idx;.ilg;.ind;.ist;.glo;>
             .glg;.gls;.nlo;.nlg;.nls;.lof;.log;.lot;.sty;.toc;.tfm;>
             .pk;.vf;.fd;.mf;.mp;.mpx;.synctex;.nsi;.nsh;>
             .dvi;.pas;.inc;.dat;.ini;.dic;.text;');

  FindInString("%!3", "\.*;", 4,5, 11);
  IfOK('Relax;','Exit;');

  Loop(!:>
    ExtractByIndex(1, "%!3", %!4, %!5-1);>
    LetReg(2,'%@("HKEY_CLASSES_ROOT","%!1\PersistentHandler"," ")');>
//    Prompt('%!1: %!2');>
    IfStr('%!2','','=',!|SetRegKey("HKEY_CLASSES_ROOT","%!1\PersistentHandler","%!0");|);>
    FindInString("%!3", "\.*;", 4,5, 1011, %!5);>
    IfOK(!'Relax;',!'Stop;');>
  :);

// Restart the computer

End;

//  Windows XP - Search Problems
//
//  Windows XP has a known issue for not finding a number of File
//  Types when you do a Search for Files "containing text" or using
//  the "A word or phrase in the file" option.  This can be remedied
//  for many file types, but not all.  The cause is the lack of a
//  PersistentHandler value in the Registry for this type of file.
//
//  You can correct this by clicking Start, Run and entering REGEDIT
//  Navigate to HKEY_CLASSES_ROOT and locating the entry for the file
//  type in question.  For example, .txt, .adm, .asp.  Expand the
//  branch for that file type, and if the PersistentHandler subkey
//  does not exist, create it.  Do this by clicking on the file
//  extension key and going to Edit, New, Key.  Name the Key,
//  PersistentHandler.   Click on the PersistentHandler sub-key.  In
//  Regedit's right pane, double click on the Default value and enter
//  the following (copy and paste may be your best bet):
//
//      {5e941d80-bf96-11cd-b579-08002b30bfeb}
//
//  If the PersistentHandler sub-key does exist, do not change the
//  default value.  This could have very undesired consequences.
//
//  Close Regedit and reboot the computer.  This file type will now be
//  searched for "A word or phrase in the file" type searches.
