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

How to attach a UI dialog to a script?

Participant ,
Oct 14, 2014 Oct 14, 2014

Copy link to clipboard

Copied

I use a custom script to batch process files into photoshop layers.

Every time I run the script I have to manually edit the folder path in the script to save the new images in a new folder.

Can a UI dialog be implemented into a script used for batch file processing?

The UI dialog:

Enter folder path

Remember the last folder path used

When the scripts runs the UI dialog displays. After the user enters the folder path the the scripts batch processes a folder of images.

TOPICS
Actions and scripting

Views

616

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
Adobe
Community Expert ,
Oct 14, 2014 Oct 14, 2014

Copy link to clipboard

Copied

Instead of entering the path manually would a folder selection dialog not be more convenient?

var theFolder = Folder.selectDialog ("select folder");

if (theFolder) {

var theFiles = theFolder.getFiles(/\.(jpg|tif|eps|psd)$/i)

};

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
Participant ,
Oct 18, 2014 Oct 18, 2014

Copy link to clipboard

Copied

I try the Folder dialog but the Bridge script does not complete when using this option.

I would like to save the new tiff file  in the same directory with the stack images.

Is there a way to omit the save location path to save the tiff in the same directory as the Bridge stack images?

        var stackFileName = app.activeDocument.name;

        var saveFile = new File('~/desktop/pscc test/'+stackFileName+' ');

        app.activeDocument.saveAs(saveFile, tifOpts, true); 

        app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

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 Expert ,
Oct 19, 2014 Oct 19, 2014

Copy link to clipboard

Copied

LATEST

There is a Bridge Scripting Forum, too, maybe you should post 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
Enthusiast ,
Oct 14, 2014 Oct 14, 2014

Copy link to clipboard

Copied

And you can save the data by putting it to an action descriptor and saving to custom options. I have assumption about JSON encoding, but many other ways of stuffing things to action descriptors are possible.

savePreferences: function (metadata) {

  var metadata_json = serialize_to_json(metadata)

  var desc = new ActionDescriptor()

  desc.putData(0, metadata_json)

  app.putCustomOptions (APP_ID, desc, true)

},

loadPreferences: function () {

  try {

  var desc = app.getCustomOptions (APP_ID)

  if (desc) {

  var metadata_json = desc.getData(0)

  if (metadata_json) {

  eval("var result = (" + metadata_json + ")")

  if (result) {

  return result

  }

  }

  }

  } catch (e) {

  var foo = e.message

  }

},

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