Code:
/script PickupContainerItem (x, y)
/script PickupInventoryItem (16)
/script PickupContainerItem (x, y)
/script PickupInventoryItem (17)
/cast YourSpell(Rank a)
a = Rank of your spell
x = Bag (from left to right 4, 3, 2, 1, 0)
y = slot ( beginns upper left and ends bottom right )