Batching files via droplet but request user input once

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

lukenalker

Batching files via droplet but request user input once

Post by lukenalker »

Hi, I'm new to ps-scripts and photoshop scripting.

I've created a basic script to save and export a few file types, .png, .tga, .dds. It includes passing some arguements to the command line for a final compression pass. I also created a simple little custom dialog that request the user to select which compression to pass, dxt1, dxt5, etc.

It works as expected on a single file, but I'm really hoping to find a good solution to run it against multiple selected files. A droplet automates my needs nicely with the exception that the custom dialog appears for each file where the user input only needs to happen once.

I've considered writing a .bat that'll pass an array of selected files, (selected via explorer), but I wanted to ask if anyone knew a better way? Perhaps I'm over looking something simple?

One note: I'd really like to have the file selection happen in explorer and not some request to browse for files after running the script. The droplet workflow would be ideal.

I really appreciate any help,

Luke

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Paul MR

Batching files via droplet but request user input once

Post by Paul MR »

If you are using Photoshop CS5 or better you could test if a key is pressed when the script is run, IE..

Code: Select allif(ScriptUI.environment.keyboardState.shiftKey){
//display your UI and get details
}


The details could be stored using app.putCustomOptions();
lukenalker

Batching files via droplet but request user input once

Post by lukenalker »

Hi Paul,

If I'm understanding you correctly, you're suggesting a workflow akin to booting windows and holding down F4 where the user knows that a reserved key, (in your example shift), will bring up a dialog of options? I suppose that could work, but it would still be preferable to display the dialog options automatically, once.

I have considered a workflow where the user would save a .ini preference file via a companion script prior to running the droplet, but that too would expect the user to be aware of a slightly obscure process.

For added clarity, this tool will be deployed to others and I'm hoping to keep it simple on the surface and maybe add advanced features in the future...like saving preferences.

Also, I just briefly looked into the putCustomOptions() method. Would that not be a way to store session like variables to be referenced across scripts or in my case multiple invocations of the same script? For example, I could set a flag to true if my UI has displayed once and suppress its display for the remainder of the batch? Though, that would suggest I would need to know how many times my script is being ran in order to clean up that setting for the next use.

Hmmm...[scratching head]

Oh yeah, CS5+ & Windows 7.

Thanks again!

Luke
Paul MR

Batching files via droplet but request user input once

Post by Paul MR »

There is no easy way of knowing the number of times a script has to be run if invoked by a droplet so it's impossible to reset a flag.
The only thing I can think of is to set the default preferences, these could be stored in a file or with putCustomOptions() the later can hold the preferences perminant or for the Photoshop session. If the user wanted to change the preferences they would hold the shift key down when dropping the files on the droplet.

I have done something simular with a watermark script below...
lukenalker

Batching files via droplet but request user input once

Post by lukenalker »

Right on. That makes sense, and thank you for the example script!

I'll post any progress I make.

Thanks again!

Luke