This is an addon I've constructed that Automatically Feeds your pet based on a series of checks:
Edits: Further refinement of the scripts to minimize undesirable events.
The first check compares the Pet happiness and whether or not the loot window is showing. If pet happiness exists and the loot window is showing and an item is attached on the cursor then it will put the item into the backpack.
The distance of your pet to you, Casting Bar Frame and Loot Frame check is performed. If any of these conditions are met then no action is taken.
Happiness is checked.
If your pet has full happiness a check to see if the cursor has an item is performed. If there is an item on the cursor and the Feed Effect is active, it will be placed in your backpack.
A check is performed to see if your pet is in combat and if so, if there is an item attached to your cursor it will be placed in your backpack.
A stand command is given, in case you are sitting at the time feeding will take place.
If your pet has less than full happiness and no Feed Effect is active then your pet will be fed.
A check is performed to see if there is an item attached to your cursor while the feeding is ocurring, if so the item will be placed in your backpack.
Lastly a check for Pet distance, cursor item and combat is performed. If the pet is outside of the distance and is in combat, any item on the cursor will go to your backpack.
The food source is the topleft slot of your backpack.
I'm providing this for testing and feedback to make it better if possible:
http://www.wowinterface.com/download...fo.php?id=3952