Skip to main content
Visuals of Light
New Participant
August 15, 2020
Question

Droplets using Photoshop javascript

  • August 15, 2020
  • 1 reply
  • 298 views

Hi

 

I want to create a droplet that does some function and returns the image back to the calling application, in this case I'm using captureOne 20. Im using Photoshop CC 2020 21.2.1

 

There are some functions which captureone does not have and I want to use photoshop such as adding borders and watermark over the border. I created a javascript which is called when I run the export function in captureone. the image should export in jpeg, load in photoshop run the javascript and back to captureone for further processing. 

 

I am facing an issue, that is in photoshop, I am prompted for save as instead of just closing the file and sending it to captureone. I'm posting the code here for reference please help

 

 

[quote]

var doc = app.activeDocument

var docResolution = doc.resolution  //given in px per inch

var docWidth =  new UnitValue (doc.width.as("px"), "px")

var docHeight =  new UnitValue (doc.height.as("px"), "px")

 

var mycolor = new SolidColor();

mycolor.rgb.hexValue = "ffffff";

app.backgroundColor = mycolor;

doc.resizeCanvas(docWidth*115/100, docHeight*115/100, AnchorPosition.MIDDLECENTER)

 

var artLayerRef = doc.artLayers.add()

artLayerRef.kind = LayerKind.TEXT

artLayerRef.name = "watermark"

 

textRef = artLayerRef.textItem

textRef.contents = "watermark"

textRef.size = new UnitValue(23, 'px')

textRef.color.hexvalue = "232323"

textRef.kind = TextType.POINTTEXT

textRef.font = "Verdana"

 

doc.save() // This one prompts save as which stops the captureone process

doc.close() // further the again prompts to save the file in PSD format

[/quote]

This topic has been closed for replies.

1 reply

Chuck Uebele
Community Expert
August 15, 2020

Try:

 

doc.close(SaveOptions.DONOTSAVECHANGES)