I believe there are different kinds of switches that can be used to adjust the stroke of an air cylinder. The method that I was referring to uses a sensor that can be adjusted along the body of the air cylinder.
This works because the sensor detects a magnet on the inside of the cylinder, once the rod has extended to the desired position the sensor will send a signal which will limit the stroke to that postion.
More information can be found here :
http://www.bimba.com/products-and-ca...?searchRef=yes