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

Batch generate image assets

New Here ,
May 25, 2018 May 25, 2018

Copy link to clipboard

Copied

Hi, this is my first post, I made an action that include the generate.jsx, When I run the full action it works great and generate Image assets next to the file.

The issue is when I try to run the script trough BATCH it does not generate the assets anymore, i think it loads generate script to fast and does not have time to generate the assets, is there any way to do a pause between script run?

I have over 500 files so I need to close files after script run.

I tried with $.sleep( 10000 ); but the sleep puts even generator to sleep.

Thank you!

TOPICS
Actions and scripting

Views

1.2K

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

correct answers 1 Correct answer

People's Champ , May 26, 2018 May 26, 2018

I think this is impossible to do. While an action or script is being executed, the generator can not be activated.

If you have windows, you can try this script.

Close all the documents in Photoshop and run the script.

Select the desired files in the FileOpenDialog.

The script will create a temporary script and bat-file in the temporary folder.

Then run bat-file. At the end of the run, you need to close the last file in Photoshop manually.

var ps_name = app.path.fsName + "\\Photoshop.exe";

var gn_name =

...

Votes

Translate

Translate
Adobe
People's Champ ,
May 26, 2018 May 26, 2018

Copy link to clipboard

Copied

I think this is impossible to do. While an action or script is being executed, the generator can not be activated.

If you have windows, you can try this script.

Close all the documents in Photoshop and run the script.

Select the desired files in the FileOpenDialog.

The script will create a temporary script and bat-file in the temporary folder.

Then run bat-file. At the end of the run, you need to close the last file in Photoshop manually.

var ps_name = app.path.fsName + "\\Photoshop.exe";

var gn_name = app.path.fsName + "\\Presets\\Scripts\\generate.jsx";

var files = app.openDialog();

if (files)

    {

    var sc_name = Folder.temp.fsName + "\\" + "temp.jsx";

    var sc_file = new File(sc_name);

    sc_file.encoding = "UTF8";

    sc_file.open("w");

    sc_file.writeln("while (documents.length > 1) documents[0].close(SaveOptions.DONOTSAVECHANGES)");

    sc_file.writeln("$.evalFile(" + gn_name.toSource() + ")");

    sc_file.close();

    var bat_name = Folder.temp.fsName + "\\" + "temp.bat";

    var bat_file = new File(bat_name);

    bat_file.encoding = "UTF8";

    bat_file.open("w");

    for (var i = 0; i < files.length; i++)

        {

        bat_file.writeln("\"" + ps_name + "\"" + " " + "\"" + files.fsName + "\"");

        bat_file.writeln("\"" + ps_name + "\"" + " " + "\"" + sc_name + "\"");

        bat_file.writeln("timeout 3");

        }

   

    bat_file.close();

    bat_file.execute();

    }

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
New Here ,
May 26, 2018 May 26, 2018

Copy link to clipboard

Copied

LATEST

I'm mac user but I installed photoshop on laptop and this works great! thank you!  I had to make the timeout bigger because I have 26 images to generate.

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