Created with colorer-take5 library. Type 'ahk'

#SingleInstance force
FileInstall, ahk.hrc, ahk.hrc , 1
FileInstall, protomod.hrc, protomod.hrc , 1
FileInstall, SyntaxTest.ahk, SyntaxTest.ahk , 1

;AutoTrim, off
FileRead, OutputVar,*t protomod.hrc

IfExist, %COLORER5CATALOG%
    InputFile=%COLORER5CATALOG%
Else
{
    FileReadLine, InputFile, %HOME%\.colorer5catalog, 1
    IfNotExist, %InputFile%
    {
        FileReadLine, InputFile, %HOMEPATH%\.colorer5catalog, 1
        IfNotExist, %InputFile%
        {
            FileReadLine, InputFile, %SYSTEMROOT%/.colorer5catalog, 1
        } 
    }
}
FileSelectFile, InputFile ,,%InputFile%, Select File,catalog.xml
Loop, Read, %InputFile%
{
    IfInString, A_LoopReadLine, proto.hrc
    {
        StringSplit, protoPath, A_LoopReadLine ,"
        break
    }        
}

If protoPath2
{
    SplitPath, InputFile ,, OutDir
    protoPath=%OutDir%\%protoPath2%

    Loop, Read, %protoPath%
    {
        IfInString, A_LoopReadLine, prototype name="ahk" group="scripts"
        {
            FoundAHK:=true
            break
        }            
    }
    if not FoundAHK
    {
        FileMove, %protoPath%, %protoPath%.bak , True
        Loop, Read, %protoPath%.bak , %protoPath%
        {
            FileAppend, %A_LoopReadLine%`n
            IfInString, A_LoopReadLine, <!--  scripts  -->
            {
                FileAppend, %OutputVar%
            }
                
        }
    }
    StringReplace, protoPath, protoPath,/,\,All
    SplitPath, protoPath ,, OutDir
    FileCreateDir, %OutDir%\scripts
    FileCopy, %A_ScriptDir%\ahk.hrc, %OutDir%\scripts, 1
}
Else
    Msgbox, Sorry! the file(proto.hrc) to patch was not found In catalog.xml.