I'm not sure if this is the right section to post in, still kinda new to the forums..

I tried searching for solutions, but couldn't find any, hence this topic.
If something like this has been talked about before, redirects are welcome.
So.. Yeah, I'm trying to make a macro for enchanting armors in bulk..
Like for example.. I load a Blacksmith with 50-60 Silk robes or so in its cart and start the bot. What i need it to do is -
1) Transfer 1 armor from cart to invent (Since the NPC works only when 1 armor exists in invent)
2) Enchant that armor
3) If it fails or breaks, get a new armor again
4) If it enchants to something I don't want say LUK+1 or INT+1, I need to re-enchant the same armor again, till I get what I need or it breaks.
5) If it gets an enchant of what I'm looking for, say DEX+3 or STR+3, It would mail/store/cart it, and retrieve a fresh armor
Now, Steps 1,2,3 are pretty easy, and I'm confident I'll be able to do them myself.
Its the steps 4 and 5, which are difficult to work out. Any kind of help on this matter would be welcome