Move code for executing scripts out of the main window into its own function.

Uses callback to report security issues.
Use translatable strings for command interface