Automatic dispenser with adjustable dispensing volume