def promptValue(sInfoText, sTitleText, sDefaultVal, iMinVal, iMaxVal, sRangeError, bRepeatPrompt):
   while True:
      sNewVal = notepad.prompt(sInfoText, sTitleText, sDefaultVal)
      if sNewVal == None:
         return None

      try:
         iNewVal = int(sNewVal)
         if iMinVal <= iNewVal <= iMaxVal:
            return iNewVal
         else:
            raise
      except:
         notepad.messageBox(sRangeError + '.\n\nYou specified: ' + sNewVal +
                              '\n\nPlease specify a number between ' + str(iMinVal) + ' and ' + str(iMaxVal) + '.',
                              'Specified value is out of range')
         if not bRepeatPrompt:
            return None