If you use Photoshop CC you don't need any script.
You can activate the built-in function "Generator" (File > Generator). This function allow you to export layers and groupgroups when you save the document, simply. Simply rename your layers/group with the extension you need (like nav.png) and eventually the parameters.
With this method photoshop will export for you the named layers/group visible with associate layer style in the same directory of your file.
See adobe article: http://blogs.adobe.com/photoshopdotcom/2013/09/introducing-adobe-generator-for-photoshop-cc.html