You must input four items in a specific order for the Cram-O-Matic to function. In some cases, the order of ingredients will affect the output. Some recipes are guaranteed to produce one thing, while others select randomly from a pool.
For most recipes, each item is assigned a type and number of points. For example, the Sweet Apple is considered a Grass item worth 30 points. The output is calculated with the type of the first item and the sum of all items' points.
Let's say you wanted to make an Absorb Bulb. You would need a Grass item in the first slot, and your four items combined would need to total 82-90 points. Therefore, a viable combination would be:
1. Sweet Apple (Grass, 30)
2. Chipped Pot (Ground, 36)
3. Silver Powder (Bug, 10)
4. Scope Lens (Dark, 12)
Sweet recipes, Poke Ball recipes, and "special recipes" are a little different.
- Sweets follow the same type/point system, but the Sweet produced is picked at random.
- Poke Balls are produced semi-randomly, with weighted probabilities for the Apricorns inputted.
- Special recipes override regular recipe if their ingredients are inputted in a specific order.
There are helpful charts and further explanations for these mechanics on my source, so I would recommend checking that out if you want to know more.
Cram-o-matic (Bulbapedia)