If you're pasting script code from the forum into a new button, you need to set this:
You may also need to then set the script language (VBScript or JScript) below that.
Alternatively, if you start from the .dcf file in the first example I linked then everything will be set up for you. (The first thread I linked has a .dcf file at the top of it. Download that, go into Customize mode, then drag it to your toolbar. It will create a button that is set up with the script in it, and you can then make any changes you need to the script.)
All of this is described in more detail here (both the 1st and 2nd posts):