Launch a script before a scan

For reference, the above has now a follow up on the question how to launch a scan from command line here: