Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all 12244 articles
Browse latest View live

Using mouse wheel to zoom and pan

$
0
0
I was wondering if there would be a way to make a javascript that would load at Photoshop's startup that would allow the user to zoom in and out using the mouse wheel (instead of using it for scrolling), and to use that same mouse wheel as a third button (when you push on the mouse wheel) or any third button on a three button mouse to pan in your image. I'm a 3ds max user and I love the way the navigation work in that software so it'd be great to be able to do that for Photoshop and Illustrator and get rid of those useless key shortcuts that we need to use to zoom and pan.

For the pan fonction, I guess if there was a way to simply say "when the third mouse button is pressed, press the space button, until the mouse button is released" it could work. But then it would force the panning to stop when the mouse goes offscreen, unlike in 3ds max where you can pan for whatever distance you want, even if you have the loop throught the screen ten times.

For the zoom function, if scolling up could simply "push" the keyboard shortcuts to zoom in/ zoom out it could work, but I don't know if that's possible. And then we'd have to disable the scrolling up and down in the document.

Anyways, if anyone has any ideas about that let me know! I've been looking for that for such a long time!

Convert Live Shape to regular path via Javascript

$
0
0

I have a script which needs to merge paths made up of multiple subpaths into a single path, and sometimes I get the dialog 'This operation will turn a live shape into a regular path'.

 

Is there a command to convert the paths/subpaths which are live shapes into a regular path (and also to determine which are live shape paths that need to be converted) via Javascript?

Export layer to a folder:

$
0
0

Hello friends! Would a script.jsx be possible to export only the active layer in the document with its respective transparency "Alpha Channel" within a folder in the path previously established in the script ?: If possible with a "trim" effect with no spaces on the 4 sides in the final file

Example: "C: //myFolder//myFile.png"

Thank you!

converting actions into script

$
0
0

Hello Guys,

 

Might be a quick answer for you or maybe not.

I have never scripted anything in my life (except a few macro files in excel) and I am green to this.

 

Simple question - I have a few "actions" in photoshop and I would like them to be converted into scripts as it might come handy for the future as I will be working with some scripters.

So how do I transform this ATN file into a script?

 

The reason behind it is that I am already having one action that has 2 scripts in it and in the future I want to add more, so I will need someone scripting to work on the script itself not actions.

 

Maybe it is also counter-productive so give me your opinion,

 

thanks.

 

Olaf

Why can't createobject Photoshop CC2017?

$
0
0

My code create object by VB.net:

Dim oApp = CreateObject(String.Format("Photoshop.Application.{0}", "110"))

I run code from other PC by remote desktop.

If i open remote desktop and run code, it working ok.

But if i run code and close remote desktop, it  can't create object . occur error: Cannot create ActiveX component

Why?

PS CC 2018 breaks previously OK Extendscripts

$
0
0

An early 'heads-up', a number of ExtendScripts that were working under PS CC 2015.5 and PS CC 2017 no longer work.  A number give inexplicable errors in the UI code.

 

I am investigating and will revert.

File information for smart objects

$
0
0

I need to get some information for the smart objects in PSD file using PS scripting.

1. I need to get the file path for the smart objects in a PSD. I found that for linked smart objects, the file path is accessible by opening it up as a document. But it would be nice if I could get the path without opening it up. Is there a way to achieve this using script? Also, for embedded smart objects is it possible to get the file path?

2. Is there a way to distinguish between linked smart objects and embedded smart object using script?

 

Thanks much in advance for any help.

Select layer by name in other document

$
0
0

So i have 2 open documents.

They both have the same names in layers.
I wrote a script that should select a layer with the same name as the selected layer in the first document.
Here is the script. Currently the code that does not work is commented out.

 

 

 

var aDoc = app.activeDocument; 

var AllDocs = app.documents; 

var actLay = aDoc.activeLayer; 

 

if (AllDocs.length > 1) { 

var itemDoc = null; 

 

var win = new Window("dialog","select the same name in other document"); 

this.windowRef = win; 

win.Txt1 = win.add ("statictext", undefined, "Paste in which open document?"); 

win.NewList=win.add ("dropdownlist", undefined, AllDocs); 

 

win.NewList.selection = 0; 

itemDoc = win.NewList.selection.index; 

  

win.testBtn4 = win.add('button', [260,140,100,50], 'select the same name in other document', {name:'doding1'});

win.testBtn4.onClick = dothing;

 

//Get selected document from list

win.NewList.onChange= function () { 

    itemDoc = win.NewList.selection.index; 

    return itemDoc; 

    } 

 

 

//Show al items

win.show(); 

 

function dothing()

{

 

//Make the selected document the active document.

app.activeDocument = app.documents[itemDoc];

app.refresh();

 

 

//This outputs [Artlayer layername]

//alert (actLay);

 

//Find right layer and set active THIS DOES NOT WORK!!

//app.activeDocument.activeLayer = app.activeDocument.layers.itemByName(actLay);

 

win.close();

}

 

 

}

else

    alert ("No other documents open");

}


Esc key dialog ui

$
0
0

Good evening

 

there would be a way to not close a dialog box by pressing the esc key

or alternatively you could make sure that if you click the esc key off all that was present before using the dialog box.

Export layer to a folder:

$
0
0

Hello friends! Would a script.jsx be possible to export only the active layer in the document with its respective transparency "Alpha Channel" within a folder in the path previously established in the script ?: If possible with a "trim" effect with no spaces on the 4 sides in the final file

Example: "C: //myFolder//myFile.png"

Thank you!

[Q] Brush's spacing setting for get/set or ignore.

$
0
0

Hi all,

 

Is there solution for Brush's spacing (check box) setting avoid reset when script set brush's hardness.

# I mean I just want to change hardness. But I'm digging hole deeper and deeper.

 

When I tried to record to change Brush's Hardness change by ScriptListner, it seems not recording.

Brush size was recorded fine. The code was re-usable.

 

I found JJMack's code at Is it possible to script brush opacity?

and testing.

 

But if Spacing checkbox was OFF, it change to checkbox ON and 25% as default setting.

Is there way to get and set checkbox of Spacing?

Or just change Hardness without spacing reset?

 

20171103_brush_spacing.png

 

Following is test code.

 

If Spacing checkbox is ON, it works as expected as no change.

If Spacing checkbox is OFF, Spacing setting gets reset.

 

 

Test code

var _r1 = getBrushFeatures ();

$.writeln("_r1 = ", _r1);

 

 

 

setBrushFeatures (_r1[0],_r1[1],_r1[2],_r1[3],_r1[4],_r1[5],_r1[6]); // test: set same value

//setBrushFeatures (1,2,3,4,5,true,false); // test: overwrite

 

 

 

var _r2 = getBrushFeatures ();

$.writeln("_r2 = ", _r2);

 

 

 

$.writeln('debugger break');

 

 

 

function getBrushFeatures (){ 

  //A Brush tool must be the current tool 

    if (!app.toolSupportsBrushes(app.currentTool)) selectBrush();  //CC 2014 

    var ref = new ActionReference();   

    ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );   

    var appDesc = executeActionGet(ref);   

    var toolDesc = appDesc.getObjectValue(stringIDToTypeID('currentToolOptions'));   

    var brushDesc = toolDesc.getObjectValue(stringIDToTypeID('brush')); 

    var currDiameter = brushDesc.getDouble(stringIDToTypeID('diameter'));   

    var currHardness = brushDesc.getDouble(stringIDToTypeID('hardness'));   

    var currAngle = brushDesc.getDouble(stringIDToTypeID('angle'));   

    var currRoundness = brushDesc.getDouble(stringIDToTypeID('roundness'));   

    var currSpacing = brushDesc.getDouble(stringIDToTypeID('spacing'));   

    var currFlipy = brushDesc.getBoolean(stringIDToTypeID('flipY'));   

    var currFlipx = brushDesc.getBoolean(stringIDToTypeID('flipX')); 

    var currentFeatures = new Array( currDiameter, currHardness, currAngle, currRoundness, currSpacing, currFlipy, currFlipx ); 

    return currentFeatures 

 

function setBrushFeatures (Diameter,Hardness,Angle,Roundness,Spacing,Flipy,Flipx) {   

    var desc = new ActionDescriptor();   

    var ref = new ActionReference();   

    ref.putEnumerated( charIDToTypeID( "Brsh" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );   

    desc.putReference( charIDToTypeID( "null" ), ref );   

    var desc1 = new ActionDescriptor();   

    desc1.putDouble(stringIDToTypeID('diameter'), Diameter);   

    desc1.putDouble(stringIDToTypeID('hardness'), Hardness);   

    desc1.putDouble(stringIDToTypeID('angle'), Angle);   

    desc1.putDouble(stringIDToTypeID('roundness'), Roundness);   

 

    // Commeting out next line will reset: Checkbox ON 25% as default

    desc1.putUnitDouble( stringIDToTypeID('spacing'), charIDToTypeID('#Prc'), Spacing); 

 

    desc1.putBoolean(stringIDToTypeID('flipY'), Flipy);   

    desc1.putBoolean(stringIDToTypeID('flipX'), Flipx);   

    desc.putObject( stringIDToTypeID('to'), charIDToTypeID( "Brsh" ), desc1 );   

    executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );   

 

Thank you,

Naoki

Script to open the Open Dialog Window

$
0
0

Hello everyone!

I'm new to scripting and this is probably an easy question but I'm trying to write a script that opens the Open Dialog Window. Basically I need to start the script in one active document, have the script open the Open Dialog (to let the user select another image) and then finish the script in the newly opened document. Every script I find is to open a specific file, but I need it to be User Selected through the Open Dialog of Photoshop.

 

I hope that makes sense! LOL. Any help would be greatly appreciated!

 

Thanks,

Bradi

Script for deleting Hidden Layers which are not used in any Layer Comp?

$
0
0

Hello.

 

I've turend the web upside down searching for a script that would do the following:

 

  1. Search through all the layer comps in the document
  2. Check which layers are hidden on all Layer Comps
  3. Remove/mark with color the layers found.

 

If anybody can provide a script that would do such a thing - it would be highly appreciated.

 

Regards,

Fade.

Action that can read and put metadata from CSV file?

$
0
0

HI,

 

I just need to create an action that do:

 

1) read 1st column of CSV file

2) find the file named the same as the test in the 1st field of CSV

3) insert all column data into the appropriate meta field

then save the psd file

4) export same psd file as a JPG and PNG while maintaining the meta info

 

Is this something that Photoshop can do that?

 

Thanks in advance!

Script Alert: "Sorry I could not process the following files" (Error Message using Image Processor)

$
0
0

I'm a seasoned Photoshop/Bridge CS5 user who recently upgraded to CS6.  In Bridge I just ran my first Image Processor batch, trying to convert a set of RAW .NEF files to .PSD files with a basic editing action I created applied to them.  Photoshop CS6 opens the files from Bridge and applies the actions, but then I get the "Script alert" error message "Sorry I could not process the following files" and a list of all of the files in the batch I was trying to run the script on.  The files all remain open and are saved on my hard drive in a folder created by the Image Processor script, but do not close unless I manually close them.  I never had this problem in CS5 where the image processor would apply the desired actions to the batch of photos one at a time, then save and close.  Thoughts on how I can fix this bug?


Photoshop Extension Panel Button Question

$
0
0

I have a panel with a button and when pressed, the button changes to a colour of my choice.

 

Question:

Is it possible for the button to remain that colour when I start working on a document in photoshop ?

 

I have tried several ways with CSS but as soon as the panel loses focus, the button colour also goes away

 

Ian

File information for smart objects

$
0
0

I need to get some information for the smart objects in PSD file using PS scripting.

1. I need to get the file path for the smart objects in a PSD. I found that for linked smart objects, the file path is accessible by opening it up as a document. But it would be nice if I could get the path without opening it up. Is there a way to achieve this using script? Also, for embedded smart objects is it possible to get the file path?

2. Is there a way to distinguish between linked smart objects and embedded smart object using script?

 

Thanks much in advance for any help.

Script to open the Open Dialog Window

$
0
0

Hello everyone!

I'm new to scripting and this is probably an easy question but I'm trying to write a script that opens the Open Dialog Window. Basically I need to start the script in one active document, have the script open the Open Dialog (to let the user select another image) and then finish the script in the newly opened document. Every script I find is to open a specific file, but I need it to be User Selected through the Open Dialog of Photoshop.

 

I hope that makes sense! LOL. Any help would be greatly appreciated!

 

Thanks,

Bradi

How can get and set x , y position of opend image ?

$
0
0

Hi,

 

I used photoshop scripting in back end.

I  am using javascript.

 

Here i do following step for image adding in layer.

1. Create main window for save psd file.

2. Create new layer in this window i.e. layer1.
3. Open image in separate new window.
4. Copy image from this window.
5. Set focus (back) in main window and i layer1.
6. Past image here.

 

Here my image is always set on center of layer1.
And i want to set image in given x,y position in layer1

 

Is any one help me so i can set this pasted image in given x,y position in layer1 ?

 

Thanks,
Mohit.

Script from ScripListener does not do anything (Eclise or Brackets) - Where am I wrong ?

$
0
0

Hi,

I've just started a mini project and would like to reuse activity code from the ScriptListener.8li.

 

My Brackets project works fine, button and function in the .jsx...

But when I insert the full text from ScriptListener_JS.log

it doesn't react at all.

No error. Just like there was no code.

NB : standard JS scrip like app.document work fine.

 

NB : Eclipse project has the same behavior.

 

Is there anything to do to "activate" or reuse this ScriptListener code ?

Thanks for help

Viewing all 12244 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>