Help Assigning Ownershp and Queue for tickets

I am looking for a scrip to assign a ticket to a queue and change the owner of the ticket to the owner of the queue.

This will be based on two criteria
One: Who is logged into the system
Two: How many open tickets are open in the owners queue.

Or just place the ticket in the queue with the least amount of open tickets if the owner is logged into the system.

If someone could point me in the right direction it would be appreciated.

Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 * 262-783-6261 ext. 2296
“Servicing North America with Local Care”