You can use JavaScripts (Extended Script) out of Photoshop to automate some processes.
There is a way to call JavaScripts for Photoshop with C# with a DoJavaScriptFile()
function:
//See the Adobe Photoshop Object Library on the COM
using Photoshop;
static void Main (args string[])
{
//Sample jsx path
var jsxPath = @ "C:\sample.jsx";
//Defines the object type List
var jsxArgs = new List < Object > ();
for (int i = 0; i < args. Length; + + i)
{
jsxArgs.Add(args [i]);
}
//List containing the arguments to(jsxArgs) a c# ToArray() to convert from //the List into an array.
app.DoJavaScriptFile(jsxPath, jsxArgs.ToArray(), Photoshop.PsJavaScriptExecutionMode.psNeverShowDebugger);
}
How can I access DoJavaScriptFile()
using Delphi code?
The only way I can manipulate Photoshop with my Delphi application uses the RunAction()
command (which is not powerful enough for my needs!):
uses ... PhotoShopTypeLibrary_TLB;
var
Form1: TForm1;
PS: IPhotoShopApplication;
DESC: IActionDescriptor;
Pic: IAutoPSDoc;
AC: IActionControl;
xi: Integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
PS.PlayAction('Name of Photoshop-Action');
end;
Any ideas anybody?
2
Answers
Problem solved:
Tried with Delphi XE and photoshop CC, when u import its tlb
there will be lots of interfaces: