I'm working with a lot of saved selections suddenly, and was wondering if there are easier ways to work with them that don't require ScriptListener script. The 3 things I can think of that I need to do with saved selections is, of course, save a selection, load a selection, and the one I can't figure out is, can I simply check to see if a selection exists in the saved selection list? I'm assuming the best way to check for a saved selection is to simply look for that selection via the channels window/tab (a feature I haven't used much as far as script is concerned). Saving a select I would imagine is fairly simple, I just don't know how to do it outside of using SL script. Loading selections gets a little more complicated as I need to load a selection from one document into another. I have SL script to do both the save and the load, but if there is a cleaner way to do those, I'm all for it. The biggest thing is how to determine if a certain selection has even been saved. Anyway, any tips anyone can give are much appreciated.
Ok, of course I go and figure out most of the things I struggled with on my own shortly after posting. For finding and loading a selection was as simple as below:
var thisDoc = app.activeDocument; var myDoc = app.documents.getByName("original.psd"); var chan = myDoc.channels.getByName("channelName"); thisDoc.selection.load(chan);
Creating the chan variable throws an error if it can't find the one specified, so it simply needs to be placed in a try statement if you simply want to see if it's there or not. The load was a lot simpler than I expected as well. I'm still a bit confused on the save though. It doesn't seem quite as cut-and-dry as the check and load. Any suggestions on simply saving a selection as a certain name?
Edit: One thing to note is; if you're loading the selection to another document; it appears that the target document must be the exact same width/height as the source of the selection.