// fileNaming.jsx // Copyright 2006-2008 // Written by Jeffrey Tranberry // Photoshop for Geeks Version 2.0 /* Description: This script illustrates how to use the slice() function to remove characters from a file name, and how to use the + sign operator to concatenate, or append a new prefix and suffix */ // enable double clicking from the // Macintosh Finder or the Windows Explorer #target photoshop // Make Photoshop the frontmost application app.bringToFront(); ///////////////////////// // SETUP ///////////////////////// ///////////////////////// // MAIN ///////////////////////// // Have Photoshop display an alert box that // displays the active document name as a string // but slice off the last four characters alert(app.activeDocument.name.slice(0,-4)); // Have Photoshop display an alert box that // displays the active document name as a string // but slice off the last four characters // and the first four characters alert(app.activeDocument.name.slice(4,-4)); // Have Photoshop display an alert box that // displays the active document name as a string // but slice off the last four characters // and the first four characters // and add "CraigsBirds_" to front of the file name alert("CraigsBirds_" + app.activeDocument.name.slice(4,-4) + ".jpg"); ///////////////////////// // FUNCTIONS /////////////////////////