on installScript handlerType,handlerName,handlerScript
  put getStackPathName() into sourceStack
  toComputer
  put the number of chars of handlerScript into handlerSize
  ---------------------------------------------------------------------------
  put "Install" && quote & handlerName & quote && "into which stack ?" into promptString
  answer file promptString of type "STAK"
  if it is empty or it is sourceStack then exit installScript
  ---------------------------------------------------------------------------
  put it into destinationStack
  go to destinationStack
  put the script of this stack into destinationScript
  put the number of chars of destinationScript into destinationSize
  ---------------------------------------------------------------------------
  if handlerSize + destinationSize > 30000 then
    play "Buzzer"
    answer "Attempt to install" && quote & handlerName & quote  && "has failed."Â
    && "Script of stack" && quote & getFileName(destinationStack) & quote && "is too full."
    go back
    exit installScript
  end if
  ---------------------------------------------------------------------------
  if handlerType is "command" then put "on" into firstWord
  if handlerType is "function" then put "function" into firstWord
  repeat with x = 1 to the number of lines of destinationScript
    if word 1 of line x of destinationScript is firstWord Â
    and word 2 of line x of destinationScript is handlerName then
      play "Buzzer"
      answer "Attempt to install" && quote & handlerName & quote  && "has failed."Â
      && handlerName && "already exists in stack" && quote & getFileName(destinationStack) & quote
      go back
      exit installScript
    end if
  end repeat
  ---------------------------------------------------------------------------
  put return & return & handlerScript after destinationScript
  set script of this stack to destinationScript
  play "voices5th"
  answer "Installation of" && quote & handlerName & quote && "was successful."
  go back
end installScript