I notice that many scripts start with Try{ and end with the catch(e). I want to know what that does exactly. It must not really be necessary, because I have a script that works fine without it. What are the benefits to wrapping your code with try{}?
Sometimes method calls will throw an exception if something goes wrong. try/catch allows the programmer to catch these exceptions and take some action. For example, a File.Open() method may throw an exception if the file is already in use.
If an exception is thrown that is not caught, it is called an unhandled exception. In this case, the framework will display a dialog and terminate the script.
In my C# programs, I catch all exceptions so that I can log them in a trace file and optionally allow the user to email the info about the exception to me. This is one reason to put a try/catch around the entire program.