Copy link to clipboard
Copied
I'm trying to create a global action descriptor that I can read from my C++ plugin in my photoshop application:
//.net creation of the actionDesc
app.DoJavascript("var desc = new ActionDescriptor(); desc.putString( 0 , app.activeDocument.name); app.putCustomOptions('Glob', desc, true);");
I'm trying to get this descriptor in my plugin and I don't know if it's possible, is it possible to get a action descriptor by name in js, or is there a way in js I can return that 'desc' action descriptor?
dynamic app = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));
To set :-
dynamic desc = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ActionDescriptor"))
desc.PutString(0, "Fred");
app.PutCustomOptions("UniqueName", desc, false); //Note false = this session only True will retain over all sessions.
To get :-
...dynamic desc2 = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ActionDescriptor"));
desc2 = app.GetCustomOption
Copy link to clipboard
Copied
dynamic app = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));
To set :-
dynamic desc = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ActionDescriptor"))
desc.PutString(0, "Fred");
app.PutCustomOptions("UniqueName", desc, false); //Note false = this session only True will retain over all sessions.
To get :-
dynamic desc2 = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ActionDescriptor"));
desc2 = app.GetCustomOptions("UniqueName");
MessageBox.Show((desc2.GetString(0)));
Hope this helps.
Copy link to clipboard
Copied
A follow up Merlin, is it possible to get the current count of the string keys in the descriptor?
I need to know what documents contain a file that was exported from an external app, so I would like to have multiple keys in the ActionDescriptor. Something like:
desc.PutString(0, "imageA");
desc.PutString(1, "imageB");
//Changed to~
desc.PutString(GetDescriptorKey(), "imageA") // count0
desc.PutString(GetDescriptorKey(), "imageB") // count1
Copy link to clipboard
Copied
Yes...
int count = desc.Count;