Try this:
#ItemCount(itemhere$,var!)
#var!=var!-1
#TakeItem(itemhere$)
#For(x!=1,x!+1,x!=var!) *I don't know if I got this code right...*
{
#GiveItem(itemhere$)
}
Like I said, I probably screwed up somewhere. Too tired to look at the command reference right now...