• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do I finish this script to open the images in photoshop?

Community Beginner ,
Mar 22, 2018 Mar 22, 2018

Copy link to clipboard

Copied

I'm a complete noob.

How do I open these images in photoshop?

     #target bridge;

     var files = Folder("/Users/chris.carey/Desktop/Get Some/").getFiles("*IMG*");

Thanks,

Chris

TOPICS
Scripting

Views

2.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 22, 2018 Mar 22, 2018

Copy link to clipboard

Copied

#target bridge

BT = '(function BT(v1, v2) {bt = new BridgeTalk(), bt.target = v1, \

bt.body = v2, bt.onResult = function(v) {return res = v.body} bt.send(2)})'

eval(BT + "('photoshop', 'File(decodeURI(Folder.startup)).fsName')")

for(fls = Folder('~/Desktop/Get Some').getFiles(/img/i), i = 0; i < fls.length; i++) {

     if (fls instanceof File) new Thumbnail(fls).openWith(res + '/photoshop.exe')

}

Ps. after you copy this code remove white spaces from end of 3rd line, as this poor editor produces some extra ones.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 23, 2018 Mar 23, 2018

Copy link to clipboard

Copied

Hey Kukurykus!

Thanks for you reply, really appreciate the help!

I've placed my original code on top of your code and it hasn't worked, is that what I was meant to do?

I'm also using a mac will that be a problem?

This is what it looks like at the moment.

Screen Shot 2018-03-23 at 11.35.26.png

Thanks,

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2018 Mar 23, 2018

Copy link to clipboard

Copied

Your code got rewritten, so just use sole script of me I posted. I shortened path you used to: Folder('~/Desktop/Get Some')​

I'm seeing there's lack of closing bracket in your error. You may tell me also what kind of error it is. Maybe there is other bug.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 23, 2018 Mar 23, 2018

Copy link to clipboard

Copied

Error - "File or folder does not exist"

Screen Shot 2018-03-23 at 11.57.31.png

I think could it be due to the /photoshop.exe seeing as im on a mac and that's windows file type?

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2018 Mar 23, 2018

Copy link to clipboard

Copied

Ah you're right. There are no .exe extension on Mac's (I'm on Windows). Go to Photoshop folder and check what's name of your Photoshop file. I heard it is .dmg mostly. You can use it in a script. If it doesn't work later I'll check it when I'm at home.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 23, 2018 Mar 23, 2018

Copy link to clipboard

Copied

Looks like we're getting a little closer though, I've recived another error but brilliant cheers for your help kukurykus.

Screen Shot 2018-03-23 at 12.41.02.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

Why are you trying to use Bridge?

With Photoshop it would be:-

#target photoshop;

var files = Folder(Folder.desktop + "/Get Some/").getFiles("*IMG*");

for(var a in files){app.open(files);}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

What you would write in search filed on Google to see what is OSX Photoshop file extension?

I spent ten minutes and any keywords I used could not reveal me this secret, am I dumb?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

There is no need to call Photoshop.

Here is an example of opening selected Bridge files in Photoshop:-

var selectedFiles=[];

for(var a = 0 ; a<app.document.selections.length;a++){

   if(app.document.selections.spec instanceof File ) selectedFiles.push(app.document.selections.spec);

    }

function script(fileList){

    for(var a in fileList){

        open(File(fileList));

        }

}

var bt = new BridgeTalk();

bt.target = "photoshop";

bt.body = "var ftn = " + script.toSource() + "; ftn(" + selectedFiles.toSource() +");";

bt.send(4);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

He doesn't want to open Files in Photoshop that are selected in Bridge. He wants to open them from a folder in Ps by Br

Anyway would you try on Browser what should I write in search filed to see what is OSX Photoshop file extension? THX!

Besides that I used .openWith(), not .open() method is that I guess you risk files may open in other Adobe product than Ps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

I am a Windows user not Mac so I would not know.

You should be using BridgeTalk then any platform will work.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

Not an answer to my question again, but let it be Problem with bT is that if you want to use Photoshop.(extension) you can check by script what's user Operating System, but I have no idea how to check appriopate Photoshop file extension by scripting so without entering this information while writing such script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

Sorry but I do not understand what you are saying.

This is using the OP's getFiles()

#target bridge;

var selectedFiles= Folder("/Users/chris.carey/Desktop/Get Some/").getFiles("*IMG*");

//check if selectFiles have the correct extension, if required

function script(fileList){

    for(var a in fileList){

        open(File(fileList));

        }

}

var bt = new BridgeTalk();

bt.target = "photoshop";

bt.body = "var ftn = " + script.toSource() + "; ftn(" + selectedFiles.toSource() +");";

bt.send(4);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

That I mean is:

When you are Windows user then it may be your Photoshop path:

C:\Program Files\Adobe\Adobe Photoshop CC 2018

And this is a file in this folder, you use to run Ps: Photoshop.exe

When you are Mac user then there is some other Ps path:

(some Macintosh path - similar to that Windows Ps path)

How by script check what's name & extension of file you use to run Ps

(so that equivalanet to Windows Photoshop.exe - can you tell me it?)

Is there any Photoshop scripting and bridgeTalk() command for this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

On a Mac things are different, have a look at this page:

What is the equivalent .exe file on OS X when launching general apps? - Quora

You could get the path via BridgeTalk I.E.

#target bridge;

function script(){

var ps =decodeURI(app.path);

var bt = new BridgeTalk();

bt.target = "bridge";

bt.body = 'alert("' +ps+'")';

bt.send(4);

}

var bt = new BridgeTalk();

bt.target = "photoshop";

bt.body = "var ftn = " + script.toSource() + "; ftn();";

bt.send(4);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

This script doesn't tell you name of file that is in Photoshop folder and is used to run Photoshop (so like photoshop.exe). It only says path to that file, what is very easy to check that or other way. Problem is you can't check name of the file.

Anyway looking at few sentences in that linked topic I suppose there is Photoshop.app on Macintosh.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

You can get most information using BridgeTalk from another Adobe App. For information specific to a Mac you would need a Mac or get the Information from a Mac user.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

It is not about Mac / Win. It is about checking by script a name of file that runs Photoshop in the system you currently use.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

The best I can think of is to use:

#target photoshop;

alert(app.path.getFiles("photoshop.*").join("\n"));

Then you can see what files are there?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2018 Mar 24, 2018

Copy link to clipboard

Copied

Yes of course, I figured this workaround myself too, but I hoped there may be some direct command, but there's not. THX

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 27, 2018 Mar 27, 2018

Copy link to clipboard

Copied

What is your Photoshop file extension in your Photoshop folder? It would be good you pasted here also full path.

EDIT 1: basing on converstaion with SuperMerlin You should use: photoshop.app. Question is why could not you check it yourself, but waited I find it first though I'm not Mac user to see files extensions. For you it takes just few seconds to see it.

EDIT 2: so did that solution from EDIT1 helped you or there was no need me to spend some time and find it out for you?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

LATEST

This is my windows photoshop scripts, but it's not working on mac sx photo selection path

 

// Open the Edges Collections directory

var strEdgeFXFolder = Folder.selectDialog ("~/Desktop/My Logo 1");

var edgeFXFile = strEdgeFXFolder .openDlg("Choose the egde you want to apply","JPEG/PNG:*JPG;*.JPEG;*.JPE;*.PNG;*.psd;*.PSD");

open (edgeFXFile)

 

help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines