programmatically determine tray number