If the master password can't be used for automation/scripting, then is there a method for encrypting the password listed in a script file?
Saved passwords (unless protected by master password) are stored in a manner that they can easily be recovered. It is not possible to securely encrypt passwords in a way that still allows for automatic use. Do not use the save password feature if you are not absolutely sure of the physical and electronic security of the system on which you are storing passwords.
This relates to storing password in GUI, but applies equally to your question.
Note that master password would not help as you would have to save it to the script too.