RepeatButton action upon release

I want to collect accelerometer force while a button is held down and when it is released a apply that to a rigid body. How do I make it so it does that?

function OnGUI () {
if (GUI.RepeatButton (Rect (10,10,150,50), "Apply Upward Force")) {
       time += Time.deltaTime;
               total += iPhoneInput.acceleration.y;
}

then i want to do something like myRigidBody.AddForce (Vector3.up * total);

I don't want the myRigidBody.AddForce to execute until after the data ids collected though.

You could do something like this:

function OnGUI ()
{
   if (GUI.RepeatButton (Rect (10,10,150,50), "Apply Upward Force"))
   {
      time += Time.deltaTime;
      total += iPhoneInput.acceleration.y;
   }
   else if (Event.current.type == EventType.MouseUp && total != 0)
   {
      ApplyTheForce ();
      time = total = 0;
   }
}

Probably o need a variable to hold the max acceleration force and then when do something like

var maxAcc = 80;

if(iPhoneInput.acceleration.y => maxAcc) { // apply to rigidbody }