Maybe write the script a bit more generic. OBSE has some neat commands, such that you can scan the players inventory for ANY alchemy ingredient, and find its effects.
First, use http://cs.elderscrolls.com/constwiki/index.php/GetNumItems to see how many unique items the player has in his/her inventory. Note: this counts UNIQUE items only, which is really what ya want...... it does not differentiate between having one steel blue entomola cap, or 5000.
Then, when you know how many items the player has, cycle thru them to find alchemy ingredients, using http://cs.elderscrolls.com/constwiki/index.php/GetObjectType. (25 is ingredients)
If you find an ingredient, then you use http://cs.elderscrolls.com/constwiki/index.php/GetNthEffectItemCode, to test the four possible positions of the type of effect you are looking for. I am currently unable to come up with a table of just what the codes are though..... there HAS to be one..... or, you may need to do a bit more hoop jumping to discover them within the script. If you find an effect you are looking for, increment your counter, or, test to see if there is more than one of them first, with http://cs.elderscrolls.com/constwiki/index.php/GetItemCount, and increment your counter by that. (of course, you would then have to make sure you removed that number of them too.... depending on what it is you had in mind.)
I assume that this script will just be running in some manner of menumode?