Feeding Batch with Array of Files, DialogModes.ALL

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

undavide

Feeding Batch with Array of Files, DialogModes.ALL

Post by undavide »

Hello,
I have to batch-process an Array of Files. Normally I'd do with app.batch() and scripting the BatchOptions, but I need the user to select parameters, so I need to display the Batch Window.

Problem is that I don't know how to pre-feed the Source field (this is the only thing users mustn't touch) with the content of my Files Array.

A workaround would be to build my own Batch Window - but frankly I'd better not do it.
The following AM code opens the dialog, but I don't absolutely know how inject my array in there.

Code: Select allvar idBtch = charIDToTypeID( "Btch" );
    var desc6 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
    var idbatchSourceType = stringIDToTypeID( "batchSourceType" );
    var idsourceOpenFiles = stringIDToTypeID( "sourceOpenFiles" );
    desc6.putEnumerated( idnull, idbatchSourceType, idsourceOpenFiles );
    var idsuppressWarnings = stringIDToTypeID( "suppressWarnings" );
    desc6.putBoolean( idsuppressWarnings, true );
executeAction( idBtch, desc6, DialogModes.ALL );

By the way, the Source dropdown menu lists "Opened Files", "Import", "Folder", "Bridge".
"Import" is promising, yet it's grayed out. (UPDATE: seems to be related to "import from camera", not useful here)
Any suggestion is welcome!
Thank you,

Davide
http://www.davidebarranca.com
csuebele

Feeding Batch with Array of Files, DialogModes.ALL

Post by csuebele »

I don't know, Davide. It looks like that's a limitation on the batch function. It seems to be an internal process rather than a jsx script. It is called out in the photoshop.jsx script in the startup folder, but I'm doubting there's much you can do there. I can understand why you don't want to create your own UI for this, as it does take a tremendous amount of time.
undavide

Feeding Batch with Array of Files, DialogModes.ALL

Post by undavide »

I've ended up writing my own interface - I doesn't need all the Batch options so I've tailored the dialog to my needs!
I've borrowed the ActionSet and Action dropdown menu from Xbytor, the rest was easy

Davide
csuebele

Feeding Batch with Array of Files, DialogModes.ALL

Post by csuebele »

You're better off doing it that way.
Mike Hale

Feeding Batch with Array of Files, DialogModes.ALL

Post by Mike Hale »

undavide wrote:Problem is that I don't know how to pre-feed the Source field (this is the only thing users mustn't touch) with the content of my Files Array.

I was going to suggest that you make your own dialog otherwise you will not be able to control the user changing the source once the dialog is open. And I also think that you would confuse your users if you used a native dialog like Batch but didn't want to allow full interaction.

I see that you already have created a custom dialog and agree that is a better way.
undavide

Feeding Batch with Array of Files, DialogModes.ALL

Post by undavide »

Thanks for the feedback Chuck and Mike!
What I've got is this one:



Which is some (work in progress) development for a script of mine called PS Projects.
As you see, it's quite basic - for instance I have implemented radio buttons instead of dropdowns (I guess the Batch dialog uses some kind of Stack layout to put dropdowns where usually the Panel's text is - and that's something I'm not willing to mess with, frankly).
No need to specify the source - it's a File array that comes from a text file.

Davide