I think that helps a lot, lets see if my understanding is correct.
Items moving on a conveyer need to be sorted by weight.
There are a range of solenoids that can select an item and each solenoid is intended for a particular range of weights.
An encoder generates pulses in proportion to the movement of the conveyer. There is a specific number of pulses to indicate the distance from the weight detector to the location of each solenoid.
The task is to weigh the moving items and activate the solenoid appropriate to each items weight when it is over that particular solenoid.
Does that match what you want to do?
If so, then there are a few more details to clarify before you should start writing your sketch.
-What is the maximum number of items that will be on the conveyer between the weighing point and the solenoid furthest away from that point? (your sketch needs to keep track of the weights for all of these)
-How many solenoids will you have?
-Do you know how many pulses there will be from the weighing point to the first solenoid?
-Do you know how many pulses between solenoids ? (are the solenoids equally spaced?)
-Does the time to activate a solenoid depend on conveyer speed? (does the speed change?)