This script may be helpful: http://forum.mikrotik.com/t/dynamic-user-profile-change-using-script/64920/1