Ok so I think I am starting to understand 🙂 My questions now are the following:
- What do you mean by bind a shortcut to a script? You want that I press a key or that the script call another script?
- Also with which part of my script should I replace the alert? The part before generating the layers or the one after the user did the changes?
If I understand well you are talking about a keyboard shortcut to call my script. The thing is that there are two parts. If I have to call a script after the user made some changes, it should be the part that crops and saves the image. But how it can start the loop again and do the same process for all the other pictures?
Finally I have to precise that the first part of my script is not simply opening the image. It opens them accordingly to a specific format and following a specific order. So we should also take this part in account and not just simply use open(fle).
Like actions can have shortcuts, Scripts too (Edit / Keyboard Shortcuts / File).
Script does not call another script. You simply call the same script, by pressing shortcut.
Till you elaborate script that works as you want, reslaunch Ps before each full script sequence:
if (!$.getenv('fls')) {
fls = File('~/desktop/Folder').getFiles()
$.setenv('fls', fls.toSource())
}
if ($.getenv('fls')) {
if (documents.length) {
// 2nd part of script
;(aD = activeDocument).save(), aD.close()
}
fle = (fls = eval($.getenv('fls'))).shift()
$.setenv('fls', fls.toSource()); if (fle) {
open(fle) // 1st part of script
}
if (!fle) $.setenv('fls', ''), alert('End!')
}