Setting up a shader through a script + Procedural terrain

Hello everyone.I have a procedurally generated tile terrain and i’m looking to use a shader to blend the edges of the tiles to get smooth transitions. Currently, the entire terrain is combined into a mesh. How would i be able to apply the shader to each tile in the mesh?

Here is the shader, or at least, the type of shader im looking to use:
http://wiki.unity3d.com/index.php?title=FourSplatBlendWrapShader

As you can see, i would need to set the 4 textures that are used for each tile, every time i call the shader. Any ideas?

My current map:

Hi! Do you get answer to your question? I have similar problem.

As I understand from your screenshot, you already have different textures in your mesh, right? So I guess you have different Materials for those textures? Or how are you generating this tiled map, as you could apply the shader right when building the procedurally generated map or you could ask, after building the map, for the different materials and replace the shader within code.