C# script help wanted

Hi,

I have a chat script in C# from Beamserver but i would like to have it edited so i can use it with a gui in Unity. Currently it takes the input from a GUIText that's linked to the script. The problem is that it takes the input of the whole screen.

Here is the script :

    void Update () {
    foreach (char c in Input.inputString) {
        // Backspace - Remove the last character
        if (c == '\b') {
            if (inputStr.Length != 0)
                inputStr = inputStr.Substring(0, inputStr.Length - 1);
        }
        // End of entry
        else if (c == '
' || c == '\r') {
            if (client.logged==false)
            {
                client.Login(inputStr, "");
            }
            else
            {
                SendChatMessage(inputStr);
            }
            inputStr="";
        }
        // Normal text input - just append to the end
        else {
            inputStr += c;
        }
    }   
    inputText.text = inputStr+cursorGraph[cursorGraphIndex];
    cursorGraphIndex++;
    if (cursorGraphIndex==cursorGraph.Length)
        cursorGraphIndex = 0;
}

I would like this to get the input from a GUI.TextField. Thanks, Eddy.

string inputStr = "";
public Rect pos, pos2;

void OnGUI () {
  inputStr = GUI.TextField(pos, inputStr);
  if (GUI.Button(pos2, "Send")) {
    SendMessage();
    inputStr = "";
  }
}