I think adding this to the PasswordDetection Script is still the best way. If the PasswordDetection script would set the Password everything after would work normally.
Biggest Problem could be: How to detect what is the correct Password without extracting, so that it can be used as a queue script.