Santhosh Nayak
Santhosh Nayak

Reputation: 2288

How to create thumbnails using Adobe bridge with C#

Is there any way to communicate with Adobe bridge using C# console application?.

I want to create thumbnails for given Image folder (ex:SamplePictures) using bridge..

I know that Bridge support java script,Is there any way to program with the JavaScript to Bridge..

Upvotes: -1

Views: 434

Answers (2)

Paul R
Paul R

Reputation: 1

The only way to program Bridge is to use BridgeTalk via com using any of Adobe's products that have com, Photoshop, Indesign, Illustrator, etc. Here is an example of getting a list of selected Bridge files.

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace Bridge
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            dynamic app = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));

            //Get list of select files from Bridge
            String Code = "var fileList;" +
            "var bt = new BridgeTalk();" +
            "bt.target = 'bridge';" +
            "bt.body = 'var theFiles = photoshop.getBridgeFileListForAutomateCommand();theFiles.toSource();';" +
            "bt.onResult = function( inBT ) { fileList = eval( inBT.body ); }" +
            "bt.onError = function( inBT ) { fileList = new Array(); }" +
            "bt.send(8);" +
            "if ( undefined == fileList ) {" +
            "fileList = new Array();}" +
            "fileList = decodeURI(fileList.toString());";

            String RC = app.DoJavaScript(Code, null, null);
            ArrayList list = new ArrayList();
            list.AddRange(RC.Split(new char[] { ',' }));
            for (int index = 0; index < list.Count; index++)
            {
                Console.WriteLine(list[index]);
            }
            Console.ReadLine();

        }
    }
}

Upvotes: -1

Related Questions