Can anyone help me. I want to create a script to create folders and run the script in Photoshop.
I am a real novice at scripting and I do not know if this can be done.
Thanks
Can anyone help me. I want to create a script to create folders and run the script in Photoshop.
I am a real novice at scripting and I do not know if this can be done.
Thanks
On all previous versions of Photoshop, including CS6 (before the recent update to PS CC), I was able to use the ExtendScript Toolkit to edit the PS preset script that adds naming/numbering sequences to files when running the "Export Layers to Files" script. For PS CS 6, I edited the script to remove the automatic naming/numbering of exported layers by editing the following in ExtendScript Toolkit:
In ExtendScript Toolkit CS6 open the Export Layers to Files.jsx (applications/adobe photoshop cs6/presets/scripts/export layers to files.jsx)
on line 1030:
change:
fileNameBody += "_" + zeroSuppress(i, 4);
to:
//fileNameBody += "_" + zeroSuppress(i, 4);
on line 1031:
change:
fileNameBody += "_" + layerName;
to:
fileNameBody += "" + layerName;
This solved my problem and allowed PS to export my layers to files, keeping the layer name as the filename without adding any naming or numbering sequences to the filename. However with the recent release of Photoshop CC, the script change above does not work. It looks as though there are some new lines of scripting with Photoshop CC and I would love to know what else I need to change to prevent PS CC from renaming files when using the Export Layers to File script. Without the ability to change this, I will have to go through numerous steps in bath rename in Bridge, which when working with 100's of files with different naming structures would totally slow down my workflow. Any ideas on what to update in the Photoshop CC Script to fix this? Thanks so very much!
I'm trying to get AppleScript scripts to execute on a remote rendering server over SSH (using the osascript command line utility). However, whenever I try to do most anything, I get various Photoshop and/or AppleScript errors that I never get when trying to run the exact same scripts locally. Ultimately, I'm trying to execute a JavaScript file passing JSON arguments from Applescript, called over SSH. Please forgive the verbosity introduced by the simple initial example.
Server: OS X 10.8.5
Photoshop: CC 2014
I see the same type of errors whether I SSH into a server and do the following manually in a shell after logging in, or feed a command to SSH to execute directly (e.g., ssh user@host 'osascript /path/to/script.scpt'). Starting from a basic example, I tried running the following AppleScript snippet. I tried entering it into osascript by hand via stdin, as well as writing it out to a file and calling it remotely. Both resulted in no new file being created, but a success message.
tell application "Adobe Photoshop CC 2014"
make new document
end tell
No matter how I try to run this remotely, I get the response "document Untitled" from osascript, and Photoshop pops up an error dialog: "Could not complete your request because of a program error."
More specific to what I'm trying to do, I've got the following code:
tell application "Adobe Photoshop CC 2014"
with timeout of 30 seconds
do javascript("/path/to/local/file.js") with arguments ({"{\"json\": \"document\", ...}"})
end timeout
end tell
When I try to run this locally, I never have a problem. But when I run it over ssh (again, either from the command line or by passing the command directly to ssh), I always get the following:
script error: Expected end of line but found identifier. (-2741)
In addition to osascript stopping with that error, Photoshop also pops up the same error dialog: "Could not complete your request because of a program error."
Anyone have any suggestions or thoughts with regard to how I can get all this working?
Thanks,
Brian
I see that the Script Listener doesn't pick this up; but is it possible to delete the currently selected anchor point (path) using Photoshop Scripting?
Hi can someone please help me alter this script from 'psd' to 'tiff'. I would like the script to specify particular compression options and I'm not sure how.
var saveFile = new File('~/desktop/'+(new Date().getTime().toString())+'.psd');
app.activeDocument.saveAs(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
The compression options I would like are as follows
Tiff (8bit)
Image Compression - JPEGG Quality 10
Layer Compression - ZIP
Hello all, first time post!
I want to be able to rotate the angle of my brush incrementally through a JSX script in Photoshop CS6, I'll be linking the script to a hotkey and using it to rotate my brush back and forth as I use it.
How would I be able to change the angle value that shows up in brush properties?
Thanks!
I tried Image Processing but it wont save .png's. Anyone know how to do this?
When I export a layer as a PNG file (using app.activeDocument.exportDocument and type=ExportType.SAVEFORWEB), the exported PNG file contains a metadata header created by Adobe.
When I export manually using File->Save for Web & Devices, I have the option to select whether to save metadata or not. The scripting API does not seem (as far as I know) to give a way to prevent metadata from being written.
What is a workaround for this? Is my only option using the code generated by script listener plugin? The problem with that is the code becomes unmaintainable quickly.
hi everyone,
so after a few hours of browsing the forum, was able to scotch tape this script together so it allows me to save my files in incremental file numbers.
- i create an action to edit the file and then in that action, i run this script x-amount of times.
- it works as i tested it a few times.
but here are my questions that i can't figure out.
1. right now it says to a folder that i have to designated. how would i edit this code so it'll save in the same folder as the file i am editing?
2. so far it saves as a jpeg. does anyone know the syntax to use for a gif?
and if you're kind enough...let's say i have an animated gif file, i can't edit it in photoshop so i have to use imageready but how do i replicate the above in imageready since we're on the same topic.
THANKS!!! code is below:
// This script will save the active document to a folder with an incremental sufix // Change the options below to match your needs var saveFolder = new Folder( 'C:\\test' ); var saveExt = 'jpg'; var saveSufixStart = '_'; var saveSufixLength = 3; jpgSaveOptions = new JPEGSaveOptions(); jpgSaveOptions.embedColorProfile = true; jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE; jpgSaveOptions.matte = MatteType.NONE; jpgSaveOptions.quality = 8; // End of user options //========================================== function zeroPad ( num, digit ){ var tmp = num.toString(); while (tmp.length < digit) { tmp = "0" + tmp;} return tmp; } var docName = decodeURI ( activeDocument.name ); docName = docName.match( /(.*)(\.[^\.]+)/ ) ? docName = docName.match( /(.*)(\.[^\.]+)/ ) : docName = [ docName, docName, undefined ]; var saveName = docName[ 1 ]; // activeDocument name with out ext var files = saveFolder.getFiles( saveName + '*.' + saveExt );// get an array of files matching doc name prefix var saveNumber = files.length + 1; //alert("New file number: " + zeroPad( saveNumber, saveSufixLength )); var saveFile = new File( saveFolder + '/' + saveName + '_' + zeroPad( saveNumber, saveSufixLength ) + '.' + saveExt ); activeDocument.saveAs( saveFile, jpgSaveOptions ,true ,Extension.LOWERCASE);
whren do I get the download for patterns and trees
Thank you
dick
A while back I asked if anyone had messed about with scripting paths in Photoshop. I got little response. Anyway I persevered with the hope of creating a circle. Just for kicks, you understand (I must get out more). Turns out there isn't much info out there on the subject only that it's not possible to create a true circle with bezier curves. I've had a look it into it and I've managed a circular approximation with paths.
// draw circular path // use at your own risk // Author: ghoulfool // Thanks to G. Adam Stanislav for the kappa explanation // Kappa Kappa Hey! app.preferences.rulerUnits = Units.PIXELS; // OPTIONALS var radius = 150; // radius of the circle to be drawn var circX = 160; // centre of circle X var circY = 160; // centre of circle Y // create a document to work with var docRef = app.documents.add("320px", "320px", 72, "Circle"); // call the source document var srcDoc = app.activeDocument; // create new layer var layerRef = srcDoc.artLayers.add() layerRef.name = "circle" layerRef.blendMode = BlendMode.NORMAL //draw circle drawCircle(circX , circY, radius, "circle") function drawCircle(X,Y,rad, pathName) { var K = (4 * (Math.sqrt(2) - 1) / 3)* rad // define circle points var C = new Array(); C = [X, Y - rad, X + rad, Y, X, Y + rad, X - rad, Y, X + K, Y - rad, X + rad, Y - K, X + rad, Y + K, X - K, Y + rad, X + K, Y + rad, X - rad, Y + K, X - rad, Y - K, X - K, Y - rad]; // create the array of PathPointInfo objects var lineArray = new Array(); lineArray.push(new PathPointInfo()); lineArray[0].kind = PointKind.CORNERPOINT; lineArray[0].anchor = new Array(C[0], C[1]); // A lineArray[0].leftDirection = [C[8], C[9]]; lineArray[0].rightDirection = lineArray[0].anchor; lineArray.push(new PathPointInfo()); lineArray[1].kind = PointKind.CORNERPOINT; lineArray[1].anchor = new Array(C[2], C[3]); // B lineArray[1].leftDirection = [C[12], C[13]]; lineArray[1].rightDirection = [C[10], C[11]]; lineArray.push(new PathPointInfo()); lineArray[2].kind = PointKind.CORNERPOINT; lineArray[2].anchor = new Array(C[4], C[5]); // C lineArray[2].leftDirection = [C[14], C[15]]; lineArray[2].rightDirection = [C[16], C[17]]; lineArray.push(new PathPointInfo()); lineArray[3].kind = PointKind.CORNERPOINT; lineArray[3].anchor = new Array(C[6], C[7]); // D lineArray[3].leftDirection = [C[20], C[21]]; lineArray[3].rightDirection = [C[18], C[19]]; lineArray.push(new PathPointInfo()); lineArray[4].kind = PointKind.CORNERPOINT; lineArray[4].anchor = new Array(C[0], C[1]); lineArray[4].leftDirection = lineArray[4].anchor; lineArray[4].rightDirection = [C[22], C[23]]; // create a SubPathInfo object, which holds the line array in its entireSubPath property. var lineSubPathArray = new Array(); lineSubPathArray.push(new SubPathInfo()); lineSubPathArray[0].operation = ShapeOperation.SHAPEXOR; lineSubPathArray[0].closed = false; lineSubPathArray[0].entireSubPath = lineArray; //create the path item, passing subpath to add method var myPathItem = docRef.pathItems.add(pathName, lineSubPathArray); // set foreground colour to green var fgColor = new SolidColor; fgColor.rgb.hexValue="00ff80" //green colour foregroundColor = fgColor //fill the path myPathItem.fillPath(fgColor,ColorBlendMode.NORMAL,100,false,0,true,true); //deselect path // ======================================================= var id630 = charIDToTypeID( "Dslc" ); var desc154 = new ActionDescriptor(); var id631 = charIDToTypeID( "null" ); var ref127 = new ActionReference(); var id632 = charIDToTypeID( "Path" ); ref127.putClass( id632 ); desc154.putReference( id631, ref127 ); executeAction( id630, desc154, DialogModes.NO ); }
This was my second attempt. The first was on a semi circle basis with two points - but the circles looked very oval. This is much better I feel.
Enjoy!
A while ago a good chap helped me out by creating a script that prompted the user for a folder, then ran the Crop and Straighten Photos command on all images contained in the folder and saved the newly created photos in a new folder. The script is below.
The script saves cropped photos as PNGs, I'd like to save them as JPEG. Could someone help me out by tweaking the script to save as JPEG? I'd like them saved with the highest quality option.
#target Photoshop app.bringToFront; var inFolder = Folder.selectDialog("Please select folder to process"); if(inFolder != null){ var fileList = inFolder.getFiles(/\.(jpg|tif|png|)$/i); var outfolder = new Folder(decodeURI(inFolder) + "/Edited"); if (outfolder.exists == false) outfolder.create(); for(var a = 0 ;a < fileList.length; a++){ if(fileList[a] instanceof File){ var doc= open(fileList[a]); doc.flatten(); var docname = fileList[a].name.slice(0,-4); CropStraighten(); doc.close(SaveOptions.DONOTSAVECHANGES); var count = 1; while(app.documents.length){ var saveFile = new File(decodeURI(outfolder) + "/" + docname +"#"+ zeroPad(count,3) + ".png"); SavePNG(saveFile); activeDocument.close(SaveOptions.DONOTSAVECHANGES) ; count++; } } } }; function CropStraighten() { function cTID(s) { return app.charIDToTypeID(s); }; function sTID(s) { return app.stringIDToTypeID(s); }; executeAction( sTID('CropPhotosAuto0001'), undefined, DialogModes.NO ); }; function SavePNG(saveFile){ pngSaveOptions = new PNGSaveOptions(); pngSaveOptions.embedColorProfile = true; pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE; pngSaveOptions.matte = MatteType.NONE; pngSaveOptions.quality = 1; pngSaveOptions.PNG8 = false; //24 bit PNG pngSaveOptions.transparency = true; activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE); } function zeroPad(n, s) { n = n.toString(); while (n.length < s) n = '0' + n; return n; };
JavaScript running in Photoshop CS6 under OS X 10.7.5 returns the wrong result for app.activeDocument.path when the file is located on the boot drive. The result is undefined and an error message incorrectly states that the document has not been saved yet. If the file is located on a remote volume, the correct path is returned.
To reproduce this problem, create a new file in Photoshop CS6 on a Mac. Save the file to the desktop. With the file still open, run the following script in ExtendScript Toolkit.
// start script
var thePath = app.activeDocument.path;
alert(thePath);
// end script
Running the same script with a file located on a server volume open in Photoshop correctly returns "/path/to/file.psd" instead of undefined and no error occurs.
This appears to be a bug in Photoshop CS6's JavaScript implementation. This problem did not exist in Photoshop CS3.
A similar issue prevents Photoshop CS6 from saving files to the boot drive using activeDocument.saveAs.
Has anyone else experienced this problem? If so, have you discovered an alternate method to determine the file path or save a file on the boot drive?
Hi Everyone!,
I wonder if it is possible, to create custom panel in Photoshop using just javascript?
(or) I have created dialog window using java script and which is use as custom panel?
Any help would be much appreciated.
- yajiviki
Does any body know what happened to the COM reference in visual studio 2008 for photoshop CS5, i just installed and my CS4 COM vanished and now there is no COM reference for photoshop CS5.
Hi all,
I am the developer of the Deco scripting engine that is used to create scripted patterns in Photoshop CS6. I would like to continue the interesting discussions and exchange of patterns and images that many of you started on the pre-release forum.
If you go to the following page (link) you can get a brief overview of how to add new scripted patterns to Photoshop CS6. Check out a few Deco scripts that create boundary patterns. The size of the boundary depends on the width
of the input pattern – you want a wider boundary, create a wider pattern.
Feel free to ask me any questions related to pattern scripting.
Enjoy,
Radomir