javascript run Batch

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

mead
Posts: 20
Joined: Sat Jul 23, 2022 12:28 am

javascript run Batch

Post by mead »

Code: Select all

#target photoshop

cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };

function Action1() {
  // Batch
  function step1(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    desc1.putPath(cTID('null'), new File("~/Desktop/x1"));
    var ref1 = new ActionReference();
    ref1.putName(cTID('Actn'), "C:/Users/Administrator/Desktop/X.jsx");
    ref1.putName(cTID('ASet'), "C:/Users/Administrator/Desktop/X.jsx");
    desc1.putReference(cTID('Usng'), ref1);
    executeAction(cTID('Btch'), desc1, dialogMode);
  };

  step1();      // Batch
};

Action1.main = function () {
  Action1();
};

Action1.main();
Batch Loop for javascript

can use javascript run Batch ?
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: javascript run Batch

Post by Kukurykus »

Replace paths for 'Actn' and 'ASet' to your Action name and ActionSet name.
mead
Posts: 20
Joined: Sat Jul 23, 2022 12:28 am

Re: javascript run Batch

Post by mead »

But I don't want to use action

Direct use of javascript
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: javascript run Batch

Post by Kukurykus »

The code is made from Photoshop Batch that uses actions, not scripts.
mead
Posts: 20
Joined: Sat Jul 23, 2022 12:28 am

Re: javascript run Batch

Post by mead »

Ok, thank you, can again ask you a question?

Code: Select all

var wbe1= File ('~/desktop/' + '/psd.txt');
wbe1.open("r");
var ps = wbe1.read();
var imageNm = ps
	for (var i = 0; i < imageNm.length; i++) {
	alert(imageNm[i], " ");
	}
txt content :123,234,345
How to use alert Prompt, respectively,

I hope prompt :123
234
345
Array respectively hints
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: javascript run Batch

Post by Kukurykus »

Code: Select all

with(File(Folder.desktop + '/psd.txt')) open('r'), r = read(), close()
lngth = (splt = r.split(',')).length; while(shft = splt.shift())
prompt((lngth - splt.length) + ':', shft)
mead
Posts: 20
Joined: Sat Jul 23, 2022 12:28 am

Re: javascript run Batch

Post by mead »

thank you
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: javascript run Batch

Post by Kukurykus »

Could you explain in the other thread (Does not support Spaces) how exactly you paste the link, that it gets img markers? Step after step...