SendKeys

General Discussion of Scripting for Adobe Bridge

Moderators: Tom, Kukurykus

Paul MR

SendKeys

Post by Paul MR »

Is there any way of using SendKeys with Bridge, everything works fine with Photoshop but not Bridge.
I have been trying C#
Code: Select allusing System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace SendKeysTest
{
    public class Driver
    {
        [DllImport("user32.dll")]
        public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [DllImport("User32")]
        public static extern int SetForegroundWindow(IntPtr hwnd);

        public static void Main(string[] args)
        {
            IntPtr iHandle = FindWindow("Bridge", null);
            SetForegroundWindow(iHandle);
            SendKeys.SendWait("^q");   
        }
    }
}
Paul MR

SendKeys

Post by Paul MR »

Got it sorted...
Code: Select allusing System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace SendKeysTest
{
    public class Driver
    {
        [DllImport("user32.dll")]
        public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [DllImport("User32")]
        public static extern int SetForegroundWindow(IntPtr hwnd);

        public static void Main(string[] args)
        {
            System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName("bridge");
            if (p.Length > 0)
            {
                SetForegroundWindow(p[0].MainWindowHandle);
            }
            SendKeys.SendWait("^q");   
        }
    }
}