To create a simple script in Photoshop follow these steps:
1. Create a file [name].jsx and put it to this folder
C:\Program Files\Adobe\Adboe Photoshop CS5\Presets\Scripts
2. Open Photoshop and go to File -> Scripts. There will be a new script with the [name].
3. If you need assign it a shortcut. Go to Edit -> Keyboard Shortcuts (Ctrl+Shift+Alt+K) and navigate to File -> Script -> [name] in the dialog.
var doc = app.activeDocument, w=850, h=doc.height doc.crop(Array(0,0,w,h))
This script crops current image to a fixed width and saves its original height.
5. Save the file and run script from File -> Scripts -> [name] or with a shortcut.