Fix logic loop in script

Fix logic loop in script attached to button [Specific Action Tag 47] so
it exists after reaching last item.