Do not compare ExtendScript with UXP. It’s a completely different thing and probably nothing would work. I personally never developed anything on ExtendScript
I don’t want to get here and why someone write code for me, I try to create my solution, if it doesn’t work, that’s why I turn to this community. Your solution above did not work at all someone who has a lot more knowledge will point me in the right direction. I’m hoping that someone here will point me to a solution that I haven’t seen a solution so far
Well… apparently something matches Wonder if that was intentional by the devs or just coincidence. In any case, if I understand correctly what you’re trying to do, I don’t think UXP supports that. Did you try checking with Alchemist if there’s some output when you load an action?
For the loading action, I believe it would same action as when you open file. But instead of “jpg” you would load “atn”. Maybe you could try open function in DOM but it might fail because it is designed only to open images and return instance of Document.
I will add note to take care of non-image files in app.open
Hi @Jarda thanks for pointing me in the right direction!
Whether app.open DOM was designed just to open images I don’t know, I just know that it actually loaded the set of actions perfectly and I believe it can also load files: csh, tpl, abr, pat asl etc…
async function importarAcao() {
const fs = require('uxp').storage.localFileSystem;
const result = await fs.getFileForOpening({ types: ["atn"] });
app.open(result);
}
await importarAcao()
@Jarda what is the method that checks if an .atn file has already been loaded in the actions palette, I tried to obtain the property in Alchemist, but I only got the number of loaded atn and not the names.
I would use validateReference and then you pass in reference object with ActionSet name in it. If true is returned then it is loaded. That is most performant way. Slower but easier way is to use DOM and loop all action sets and search for name match:
You could simply run the action and if it returns an error, load it, and then run it again. If it doesn’t error out, then it’s loaded. Not terribly elegant, I suppose, but I doubt users could tell the difference.
@Jarda What have you not tested? What are you referring to?
validate Reference seems like an interesting approach.
For some reason, even with atn loaded, I always get false as a return;
I was referring to hypothetical the error on the second run.
Maybe you could try to add an application reference as a second item in the reference array to test. It will probably won’t help but there are not much other options remaining