Javascript y Photoshop
Hola a todos yo soy fotógrafo, trabajo con el PS y en mi ratos libres hago scripts para Photoshop.
Me gustaría encontrar gentes, con quien intercambiar opiniones sobre guiones en Javascript para Photoshop.
Aquí en Adobe hay un foro muy bueno, pero en ingles, y yo sólo se hablar español y algo de francés.
Saludos
Hola, Manolo.
Me cuesta creer que seas el único hispanohablante del mundo que utilice guiones en Photoshop; sólo que todavía no ha aparcido ningún otro en estos foros. Basta mirar el número de temas publicados en toda su historia para darse cuenta que, a pesar de los notables progresos en el último año, todavía no somos suficientemente conocidos. Es labor de todos nosotros contribuir a mantenerlos con vida y hacerclos progresar.
Muy bueno tu enlance, espero que lo vean todos los usuarios de Photoshop.
¡Contamos con tu ayuda!
Similar Messages
-
How do I localize text strings in the javascriptresource section i a Javascript for Photoshop?
I have made a javascript for photoshop. I am using the <javascriptresource> and <terminology> tags to make the script to work with actions. How do I make the textstrings within the <javascriptresource> section local (translated)? The localize function and other ways to localize text that I described in the documentation do not work.
I recommend that you post your question in the scripts forum as this forum is meant for beginners. It is not that we won't help, it is that we may not beable to provide the best help. Good luck, I hope you can figure it out.
http://forums.adobe.com/community/photoshop/photoshop_scripting?view=discussions
http://forums.adobe.com/community/photoshop/photoshop_sdk?view=discussions -
How to call a JavaScript in Photoshop?
Hello,
I created 3 simple scripts (converted PS Actions to JavaScript) as a test: Script1.jsx, Script2.jsx, Script3.jsx
How would I go about creating another JavaScript that runs these three JavaScript consecutively (while in photoshop)
..I can create a simple PS Action of opening the three scripts (which works).. but when I convert this back to a Javascript, I receive an error.
My goal is for the ability to create a JavaScript that can call the three scripts.
ie:
call Script1.jsx
call Script2.jsx
call Script3.jsx
Can this be done?
Thanks for any help
JeffThanks, Paul.
Worked!... with a slight modification.
Received errors until I added a backslash at the end of the SCRIPTS_FOLDER path, and removed the backslash from the FILE name begining.
var SCRIPTS_FOLDER = "/z/ANIMATION/Max_Renders/FaceLevels/ActionsScripts/";
var Script1 = File(SCRIPTS_FOLDER + "Script1.jsx");
var Script2 = File(SCRIPTS_FOLDER + "Script2.jsx");
var Script3 = File(SCRIPTS_FOLDER + "Script3.jsx");
$.evalFile (Script1);
$.evalFile (Script2);
$.evalFile (Script3);
Thanks allot!
Jeff -
Fehlender JavaScript-Code Photoshop CS5 beim automatisieren
Neu gekaufter und installierter MacPro, mit System 10.6.5, 1 TB Festplatte, 8 GB RAM. ( Leider nicht meiner :-( . )
CS5 installiert, MS Office 2008, Flip4Mac, Divx, Realplayer, VLC, iLife 11, iWork ...
Kurz gesagt nichts ungewöhnliches installiert. Bei System und CS5 alle Updates installiert.
Folgende Fehler:
Photoshop CS5: Beim Automatisieren "Photomerge" und "Zu HDR zusammenfügen" kommt folgende Fehlermeldung
"Fehlender JavaScript-Code"
Flash CS5 Proffessional: direkt zu Beginn: "Fehler beim Initialissieren der Java Runtime Environment. Eventuell müssen Sie Flsh neu installieren."
In beiden Fällen Programm neu installiert, Updates aufgespielt aber keine Besserung.
Please Help!
Danke
WolfBoilerplate-text:
As with all unexplainable Photoshop-problems you might try trashing the prefs (after making sure all customized presets like Actions, Patterns, Brushes etc. have been saved and making a note of the Preferences you’ve changed) by pressing command-alt-shift on starting the program or starting from a new user-account.
System Maintenance (repairing permissions, purging PRAM, running cron-scripts, cleaning caches, etc.) might also be beneficial, Onyx has been recommended for such tasks.
http://www.apple.com/downloads/macosx/system_disk_utilities/onyx.html
And the generally used language in this Forum is English, but there is a German language Forum:
Germany -
Menu in Javascript for Photoshop (CS6)
Greetings........
WillemI'm just a hacker don't know much about javascript, Photoshop scripting and Photoshop script dialog. However I have hacked some cutting pasting and modifying what others have written. It is possible to have drop down menu in Photoshop script dialog and also execute some code when changes are made to some items in dialogs even the script dialogs can be made dynamic. However that is beyond me.
The most outstanding dialog I have seen is found in X's dialog in the Image Processor Pro plug-in script that can be downloaded from Russell Browns webs site. You can add tabs to its dialog and save the modification for use in the future. You can save customized dialogs for different work flow processes. I blows my mind....
I think if you download some scripts that have dialogs you will see triggers like On Change or on Click etc. Pull-down menu items may be a static array of items or built by retrieving thing like user machine fonts. I don't know for sure what can be done or or use to triggers functions. I have senior moments as soon as I hacked one I forget what I hacked or how I did it.
That is most of the time I seem to remember static and dynamic pull-down and on click triggers in this script I hacked.
http://www.mouseprints.net/old/dpr/InteractivePopulateCollage.jsx
Its dialog look like this you can see it has four on click buttons and some pull down menus and a check box. Other thing like radio buttons are also possible -
How can I set CameraRAWOpenOptions using Javascripts in Photoshop CS6?
I have been unable to set CameraRAWOpenOptions in scripts that worked fine for me in Photoshop CS5 but now do not work in Photoshop CS6. There are no error messages when I run the scripts, and they appear to finish okay, but the images come out unadjusted. Below is the essence of how I'm trying to do it. When I run these scripts in Extendscript (CS5 or CS6 does not make a difference), Photoshop CS6 simply uses its own default (saved) settings, but CS5 would allow the overrides. I did change the default settings in CameraRAW in CS6 to use the default lens correction profiles available from the EXIF data, and I'm wondering if that rendered the script unable to change any of the rest of the settings.
Here's how I have the code:
var RawOptions = new CameraRAWOpenOptions;
RawOptions.settings=CameraRAWSettingsType.CUSTOM;
RawOptions.exposure=+2.00;
RawOptions.vignettingAmount = 0;
RawOptions.vignettingMidpoint = 0;
RawOptions.contrast = 50;
RawOptions.saturation = 0;
RawOptions.shadows = 0;
RawOptions.luminanceSmoothing = 0;
var JPGopts = new JPEGSaveOptions;
JPGopts.quality = JPEGquality;
//Perform the loop through the files
app.open(testListing[0], RawOptions, false);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
for (var nfile = nstart; nfile < nstop; nfile++)
app.open(testListing[nfile], RawOptions, false);
FnameSave = new File(SavePath+"/"+testListing[nfile].name);
app.activeDocument.saveAs(FnameSave, JPGopts, false, Extension.UPPERCASE);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);I would collapse and expand the toolbar windows by using the double arrow icon?
Doing this will almost give you your full screen?
Or you can hit 'Tab' and it hides your tools when you don't need them? -
Please help me to do that and thanks a lot ...
Has to be written into the app by the developer. Send them a suggestion to add such a feature.
-
AppleScript via JavaScript (doScript in Photoshop)
Hi everyone,
I was looking for a way to execute AS from JS to bind my AS on hotkey.
I found a thread with this code in there:
// JavaScript
var myscr = new File('/C/1/book/my.vbs');
if (myscr.exists) {
app.doScript(myscr, ScriptLanguage.visualBasic)
do I thought that I'll create a .jsx file with this code and it'll work
var myscr = new File('/Users/macintosh/Documents/Adobe Scripts/enter.applescript');
if (myscr.exists) {
app.doScript(myscr, applescriptLanguage)
but it didn't
I fought that the problem is that doScript is from inDesign/Illustrator and tried doAction but it seems it's only for Actions.
Please explain me what am I doing wrong?
Kind regards, SergeyTake a look at the documentation each of Adobe's apps differs in its scripted commands. ID has 'do script' in given language (the best of the bunch) Photoshop will let AppleScript & Visual Basic do JavaScript. Illustrator is like Photoshop except you can pass an arguments array to the command…
File.execute(); did NOT work with my quick test the calling JavaScript:
#target photoshop
var appleScript = new File('~/Desktop/Test.app');
if (appleScript.exists) appleScript.execute();
The AppleScript compiled and saved as 'Application' in on run statement…
on run
tell application "Adobe Photoshop CS2"
activate
if exists document 1 then
set Doc_Ref to current document
tell Doc_Ref
set Doc_Name to name
display alert "Testing" message ¬
Doc_Name giving up after 2
end tell
else
display alert "Script Error" message ¬
"No document is open." as warning giving up after 2
end if
end tell
end run -
Can you tile windows from Javascript in CS3?
I have a javascript that will open 2 images in Photoshop from different directories based on a single filename, so that the users can view them side by side. They need this to be able to compare the colour correction from an automated process against the original image.
The trouble is that even though I can open the images, I cannot invoke the "window/arrange/tile vertically" menu item, as I can with InDesign.
Does anyone know of a neat trick to get around the missing tile vertically command within Javascript for Photoshop CS3.
(I've trawled the web and found that most answers are for 4 or more windows, where the images are pasted into one doc. But here I need to keep the windows separate.)One way to do this in CS3 is with an action. Make a new action then stop recording. There should be no steps in the action. From the action panel's flyout menu choose insert menu item. Then choose the "window/arrange/tile vertically" menu item. You now have an action that you can call from a scipt to tile the two images.
Another way is to use Xbytor's doMenuItem function
// adatped from Xbytor's xtools stdlib.jx
doMenuItem = function(item, interactive) {
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Mn "), charIDToTypeID("MnIt"), item);
var desc = new ActionDescriptor();
desc.putReference(charIDToTypeID("null"), ref);
try {
var mode = (interactive != true ? DialogModes.NO : DialogModes.ALL);
executeAction(stringIDToTypeID("select"), desc, mode);
} catch (e) {
if (!e.message.match("User cancelled")) {
throw e;
} else {
return false;
return true;
doMenuItem(stringIDToTypeID('tileVertically'));
Note newer version of Photoshop have a app method named runMenuItem that can be used instead of a custom function. -
Here's my current javascript:
#target photoshop
// sets document preferences to inches
app.preferences.rulerUnits = Units.INCHES
// these are our values for the END RESULT width and height (in inches) of our image
var fWidth = 11.73;
var fHeight = 5.97;
var CurrentDLPFile=app.activeDocument
var CurrentDLPFileName= CurrentDLPFile.name
var CurrentDLPFilePath="~/Desktop/fetch"
var f = File.saveDialog('Save Where?','');
// in case we double clicked the file
app.bringToFront();
// resizes the canvas to 11.73 x 5.97 inches
CurrentDLPFile.resizeCanvas(UnitValue(fWidth,"in"),UnitValue(fHeight,"in"));
// flattens all layers
CurrentDLPFile.flatten();
// saves as photoshop file
if (f!=null) CurrentDLPFile.saveAs(f,undefined);
// splits channels
CurrentDLPFile.splitChannels();
// converts active K seperation to bitmap form
var bitsaveoptions = new BitmapConversionOptions()
bitsaveoptions.method = BitmapConversionType.HALFTONESCREEN
bitsaveoptions.angle = 45
bitsaveoptions.frequency = 55
bitsaveoptions.resolution = 300
bitsaveoptions.shape = BitmapHalfToneType.ROUND
app.activeDocument.changeMode(ChangeMode.BITMAP,bitsaveoptions);
// THIS IS WHERE I'M HAVING ISSUES- I want to save the file (which at this point is a bmp), with a suffix of 1 in the same folder; and then close the file.
var doc = app.activeDocument;
var docName = doc.name;
docName = docName.match(/(.*)(\.[^\.]+)/) ? docName = docName.match(/(.*)(\.[^\.]+)/):docName = [docName, docName];
var suffix = '_1';
var saveName = new File(decodeURI(doc.path)+'/'+docName[1]+suffix+'.bmp');
function saveFile(app.activeDocument, saveName);I figured it out, here's for anyone else who is struggling with a similar problem:
var CurrentDLPFile=app.activeDocument
// saves active doc as photoshop file
if (f!=null) CurrentDLPFile.saveAs(f,undefined);
//renames active document to whatever was saved
var CurrentDLPFile = app.activeDocument.name
//assigns the location of the saved psd
var psdPath = activeDocument.path
saveBMP = new BMPSaveOptions();
saveBMP.alphaChannels = false;
saveBMP.depth = BMPDepthType.ONE;
saveBMP.flipRowOrder = false;
saveBMP.rleCompression = false;
saveBMP.osType = OperatingSystem.WINDOWS;
var doc = app.activeDocument;
var Name = doc.name.replace(/\.[^\.]+$/, '');
var Suffix = "1";
var saveFile = File(psdPath + "/" + Name + Suffix + ".bmp");
activeDocument.saveAs(saveFile, saveBMP, true, Extension.LOWERCASE);
activeDocument.close( SaveOptions.DONOTSAVECHANGES ); -
Having trouble with the File and Folder Objects (PSCS3 javascript on Win)
I'm having trouble successfully creating a new folder on my windows platform, using javascripts in photoshop. In ExtendScript Toolkit 2, set to Adobe Photoshop CS3, I've tried:
var myFolder = new Folder("/c/Documents and Settings/vcastelo/My Documents");
myFolder.create();
and
var myFolder = new Folder("/c/Documents and Settings/vcastelo/My Documents");
is this right? what am I doing wrong? It's pretty basic stuff, I know but I can't figure is out... any help would be greatly appreciated.[email protected] wrote:
> oh I see, I just figured it out... the drive designation isn't case sensitive... but i didn't add the name of new folder to the destination path.
Yep.
>
> var myFolder = new Folder("c:/Documents and Settings/vcastelo/My Documents/data");
> myFolder.create();
The "/c/Documents and Settings/vcastelo/My Documents/data" form works, too, and
should be preferred.
Here's an extreme example as to why this is a good idea:
I work in an XP/cygwin environment, so I added links to all of my drives in my
root cygwin folder. As a result, the path /p/Pictures/2008-05-05 is the same on
the bash command line (and other tools) as it is in PSJS. I carried this over to
my Mac, as well. I mount P: drive in OSX then setup links so that
/p/Pictures/2008-05-05 is also the same on the Mac. This has vastly simplified
my work. The only time I use system-specific pathnames is in a script's UI.
-X
for photoshop scripting solutions of all sorts
contact: [email protected] -
Javascript that worked in CS4 not working in CC
I wrote a Javascript tool that creates perspective grids in Photoshop a while ago. It works fine in Photoshop CS4. However, I've been getting a few emails complaining that it does not work in CC. I've checked the CC release of the Javascript in Photoshop reference guide, but it appears that nothing has changed relevant to my code since CS4. Any idea what's happening in PS that is causing this script to fail?
http://kitfox.com/projects/photoshopPersp/Perspective%20Grids.jsx
Full webpage:
http://kitfox.com/projects/photoshopPersp/index.htmlI've changed the script. I now create my path layer using the below function. However, even after explicitly changing the ruler units to PIXELS, the paths I create all seem to be measured in POINTS. Even if the original ruler unit is PIXELS this still happens. Is there any way around this (that is backwards compatable)?
function createPathLayer(title, subPathArray)
var docRef = app.activeDocument;
var originalUnit = app.preferences.rulerUnits;
alert("Orig units " + originalUnit);
app.preferences.rulerUnits = Units.PIXELS;
var myPathItem = docRef.pathItems.add(title, subPathArray);
alert("New units " + Units.PIXELS);
app.preferences.rulerUnits = originalUnit; -
I have got more than 400 scanned documents of A4 size. But they are not of uniform size. Luckily they are all of 300 dpi.They were created on a scanner. When opened in photoshop they contain random patches that are transparencies, although there seems to be no difficulty viewing themon adobe reader.
My laptop had "Gb RAM and does not accept CS4 I have Photoshop CS3. My javascript and photoshop are both limited to basic skills.
I would like to mount each document on a white A4 sized photoshop background of300dpi, as a layer, flatten it out and save as the desired page.
As this is rather time-consuming, I would like to have a script that will perform this task, on a single file.
I would like to manually run this script on each file.
If possible I would additionally like to put the individual pages in a folder and run the script repetetively on all files in the folder.
Any suggestions or held will be gratefully appreciated
thanks, peterThis has now been modified for single page PDF's.....
#target Photoshop
app.bringToFront;
function main(){
var inFolder = Folder.selectDialog("Please select folder to process");
if(inFolder == null) return;
var startRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var pdfOpenOptions = new PDFOpenOptions();
pdfOpenOptions.antialias = false;
pdfOpenOptions.suppressWarnings = true;
pdfOpenOptions.usePageNumber = true;
pdfOpenOptions.mode = OpenDocumentMode.RGB;
pdfOpenOptions.page = 1;
var fileList = inFolder.getFiles(/\.(pdf)$/i);
var FillColour = new SolidColor;
FillColour.rgb.hexValue = 'ffffff';
app.backgroundColor= FillColour;
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 file= open(fileList[a],pdfOpenOptions);
var doc = activeDocument;
doc.flatten();
var docname = fileList[a].name.match(/(.*)\.[^\.]+$/)[1];
if(doc.resolution != 300) doc.resizeImage(undefined,undefined,300,ResampleMethod.NONE );
if(doc.width.value > doc.height.value){
app.activeDocument.resizeCanvas(3508, 2480, AnchorPosition.MIDDLECENTER);
}else{
app.activeDocument.resizeCanvas(2480, 3508, AnchorPosition.MIDDLECENTER);
var saveFile = new File(decodeURI(outfolder) + "/" + docname + ".jpg");
SaveJPEG(saveFile, 8);
activeDocument.close(SaveOptions.DONOTSAVECHANGES) ;
app.preferences.rulerUnits = startRulerUnits;
main();
function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality; //1-12
activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE); -
I'm learning scripting. I don't suppose there are many books on the subject of javascriping for photoshop? I've avoided the Official JavaScript Reference as that's available as a PDF. I finally tracked down a copy of Photoshop CS2 Speed Clinic, but it's very thin on the subject of scripting -it almost mentions it in passing; rather than the nuts and bolts of scripting which is what I'm after. I realised that this is a niche area but I expected to find a bit more on the subject.
CheersThe only book I know about for scripting Photoshop is old( Photoshop 7 ).
When creating javascripts for Photoshop you need to know the 'core' javascript. Data types, native classes, syntax, etc. and you need to know the Photoshop DOM. The problem I have with most javascript books is they are written for web developers and cover javascript and the browser DOM as if they where the same thing.
You can find a reference to the Photoshop DOM in the javascript scripting guide that ships with Photoshop. For javascript I would recommend "JavaScript: the definitive guide" By David Flanagan.
You can find some online javascript core references at http://www.croczilla.com/~alex/referenc ... index.html and http://www.croczilla.com/~alex/referenc ... index.html I also like http://www.w3schools.com/js/default.asp
I think at some point you are going to have to stop avoiding the official javascript references from Adobe. -
Need to play actions in PSE 9.0 from JavaScript
Hi All,
I have been facing this problem now for three days ..!!! I have just switched to PSE 9.0 from PS CS 5... In the past, i had success in playing actions through javascript in Photoshop... But the same is giving me a dead end with Photoshop Elements in the picture ... Any help or guidance regarding this is highly appreciable..!! Pls guide me fellas..!!!
Thanks..!Your code for the PQR action should look like this:
It doesn't matter where the actions are on your computer as long the path in the script
points to the action and then you tell elements which action to play.
In other words you don't have to put the actions in actions player folder.
If you want to run actions in the Full Edit Mode, you can install the actions into the effects panel.
By installing them in the effects panel, you have access to all the menu commands that are
normally greyed out in the guided edit mode. Also some functions that work in the full editor
will not work in the guided edit mode, so your actions may give errors.
Installing in effects panel:
http://www.texaschicksblogsandpics.com/photography-page/installing-actions-in-photoshop-el ements/
Also you can place your scripts in the Automation Tools menu by putting a
javascript resource code at the top of your script, but the automation tools menu is greyed
out in the guided edit mode.
Then you would place the script in the pse 9 presets>scripts folder and after restarting
or starting pse 9 there on the menu.
C:\Program Files\Adobe\Photoshop Elements 9\Presets\Scripts
MTSTUNER
Message was edited by: MTSTUNER
Maybe you are looking for
-
Dear All; I am new to JSF. I have built a small sample application on JSF that is integrated with jetspeed which takes user name and password. If password is true it goes to successPage else goes to errorPage. This functionality is working fine. I wa
-
[network] SkipStone (a lightweight browser)
PKGBUILD: # Contributor: Shahar Weiss <[email protected]> pkgname=skipstone pkgver=0.9.3 pkgrel=1 pkgdesc="SkipStone is a Gtk+ Web Browser that embeds Mozilla's rendering component Gecko. It aims to be light and fast with few dependencies." url="http
-
Why cant i install airport extreme 802.11n on my macbook running 10.8.4
I just bought an airport extreme 802.11n and i cant install it on my macbook pro running 10.8.4. It says its not compatible. Im no genius, so if anyone can help, please go easy on me!
-
First time use of camera does not make a sound but use again then shutter sound can be heard
when i first usse the camera on my i phone 4s the shutter does noy make a sound. when used again then the shutter soound works.....any ideas/????????????
-
Hi, I want to create radiobutton next to a radiobutton.I.e both are parallel to each other.How to create?