Need help in accessing photoshop with c#.net

K

KAMAL

Sir,

We need some help in photoshop Add-in.
Here i am sending the problem. Please do in favour in solving the problem.
Through the .Net application we are activating the photoshop and sending
the short cut keys to photoshop for activating the adjustment dialog boxes.



in C#.net

Interaction.AppActivate("Adobe Photoshop");
SendKeys.Send("^l");

//^l -- is the shortcut key for opening levels
//^m -- is the shortcut key for opening cureves
//^b -- is the shortcut key for opening colorbalance
//^u -- is the shortcut key for opening Hue/Saturation

===>>> It can be done by using sendkeys function in use32.dll also <<<====
//in the process p it will contains the adobe photoshop
//Importing user32.dll for usage of PostMessage which is used for sending
the messages to a process
[System.Runtime.InteropServices.DllImport("user32.dll")]

static extern bool PostMessage(HandleRef hWnd, uint Msg, IntPtr
wParam,IntPtr lParam);

ProcessStartInfo pinfo = new ProcessStartInfo("Photoshop");
Process[] p1 = System.Diagnostics.Process.GetProcessesByName("Photoshop");

Process p = p1[0];
System.IntPtr ptr = p.MainWindowHandle;
System.IntPtr ptr1 = p.Handle;
IntPtr hwnd = ptr;
Const WM_COMMAND = &H111;
int err;
err = PostMessage(hwnd, WM_COMMAND, 1801, 0); //1801 is the address of

It will activates the levels adjustment in photoshop application. After
doing need ful adjustments
in the levels dialog box "ok" button or "cancel" button will be clicked.
That button which is clicked
in levels dialog box that response is to be sended back to the .Net
application .
With that received response from the photoshop i have to send the next
adjustment tool code
which is to be activated.

This is the first adjustment tool opened after sending the short cut key.




After clicking the Ok button of the levels dialog box the next adjustment
tool "cures" has to be active automatically.




After clicking the Ok button of the "curves" dialog box the next adjustment
tool "Color Balance" has to be active automatically.




The every thing opening of the adjustment tools to be automated after
clicking "OK" or "Cancle" button in active dialog box the next adjustment
tool to be opened automatically.
 
R

RobinS

You posted this to a bunch of different dotnet newsgroups.
In the future if you want to do that, post the message in all
the newsgroups at one time. This way, if anyone has a response
in one newsgroup, it is displayed in all the groups where
the message was posted.

Robin S.
 
C

Cor Ligthert [MVP]

Robin,

I see persons who post in the way like this as Trolls and don't even take
the effort of answering those.

Cor

RobinS said:
You posted this to a bunch of different dotnet newsgroups.
In the future if you want to do that, post the message in all
the newsgroups at one time. This way, if anyone has a response
in one newsgroup, it is displayed in all the groups where
the message was posted.

Robin S.
-----------------------------------
KAMAL said:
Sir,

We need some help in photoshop Add-in.
Here i am sending the problem. Please do in favour in solving the
problem.
Through the .Net application we are activating the photoshop and sending
the short cut keys to photoshop for activating the adjustment dialog
boxes.



in C#.net

Interaction.AppActivate("Adobe Photoshop");
SendKeys.Send("^l");

//^l -- is the shortcut key for opening levels
//^m -- is the shortcut key for opening cureves
//^b -- is the shortcut key for opening colorbalance
//^u -- is the shortcut key for opening Hue/Saturation

===>>> It can be done by using sendkeys function in use32.dll also
<<<====
//in the process p it will contains the adobe photoshop
//Importing user32.dll for usage of PostMessage which is used for sending
the messages to a process
[System.Runtime.InteropServices.DllImport("user32.dll")]

static extern bool PostMessage(HandleRef hWnd, uint Msg, IntPtr
wParam,IntPtr lParam);

ProcessStartInfo pinfo = new ProcessStartInfo("Photoshop");
Process[] p1 =
System.Diagnostics.Process.GetProcessesByName("Photoshop");

Process p = p1[0];
System.IntPtr ptr = p.MainWindowHandle;
System.IntPtr ptr1 = p.Handle;
IntPtr hwnd = ptr;
Const WM_COMMAND = &H111;
int err;
err = PostMessage(hwnd, WM_COMMAND, 1801, 0); //1801 is the address of

It will activates the levels adjustment in photoshop application. After
doing need ful adjustments
in the levels dialog box "ok" button or "cancel" button will be clicked.
That button which is clicked
in levels dialog box that response is to be sended back to the .Net
application .
With that received response from the photoshop i have to send the next
adjustment tool code
which is to be activated.

This is the first adjustment tool opened after sending the short cut key.




After clicking the Ok button of the levels dialog box the next adjustment
tool "cures" has to be active automatically.




After clicking the Ok button of the "curves" dialog box the next
adjustment tool "Color Balance" has to be active automatically.




The every thing opening of the adjustment tools to be automated after
clicking "OK" or "Cancle" button in active dialog box the next adjustment
tool to be opened automatically.
 
R

RobinS

I think of them as uninformed. If I see the same post in one or two .Net
newsgroups, it doesn't bother me as much as some idiot (like this one) who
posts in all of them whether they are relevant or not. A lot of people
apparently don't know any better. When I've posted here as long as you
have, I will probably have a different point of view. ;-)

I think that like me, you read most, if not all, of the more active dotnet
newsgroups, and thus see the multi-posts.

Robin S.
--------------------------------------------

Cor Ligthert said:
Robin,

I see persons who post in the way like this as Trolls and don't even take
the effort of answering those.

Cor

RobinS said:
You posted this to a bunch of different dotnet newsgroups.
In the future if you want to do that, post the message in all
the newsgroups at one time. This way, if anyone has a response
in one newsgroup, it is displayed in all the groups where
the message was posted.

Robin S.
-----------------------------------
KAMAL said:
Sir,

We need some help in photoshop Add-in.
Here i am sending the problem. Please do in favour in solving the
problem.
Through the .Net application we are activating the photoshop and
sending
the short cut keys to photoshop for activating the adjustment dialog
boxes.



in C#.net

Interaction.AppActivate("Adobe Photoshop");
SendKeys.Send("^l");

//^l -- is the shortcut key for opening levels
//^m -- is the shortcut key for opening cureves
//^b -- is the shortcut key for opening colorbalance
//^u -- is the shortcut key for opening Hue/Saturation

===>>> It can be done by using sendkeys function in use32.dll also
<<<====
//in the process p it will contains the adobe photoshop
//Importing user32.dll for usage of PostMessage which is used for
sending the messages to a process
[System.Runtime.InteropServices.DllImport("user32.dll")]

static extern bool PostMessage(HandleRef hWnd, uint Msg, IntPtr
wParam,IntPtr lParam);

ProcessStartInfo pinfo = new ProcessStartInfo("Photoshop");
Process[] p1 =
System.Diagnostics.Process.GetProcessesByName("Photoshop");

Process p = p1[0];
System.IntPtr ptr = p.MainWindowHandle;
System.IntPtr ptr1 = p.Handle;
IntPtr hwnd = ptr;
Const WM_COMMAND = &H111;
int err;
err = PostMessage(hwnd, WM_COMMAND, 1801, 0); //1801 is the address of

It will activates the levels adjustment in photoshop application. After
doing need ful adjustments
in the levels dialog box "ok" button or "cancel" button will be
clicked. That button which is clicked
in levels dialog box that response is to be sended back to the .Net
application .
With that received response from the photoshop i have to send the next
adjustment tool code
which is to be activated.

This is the first adjustment tool opened after sending the short cut
key.




After clicking the Ok button of the levels dialog box the next
adjustment tool "cures" has to be active automatically.




After clicking the Ok button of the "curves" dialog box the next
adjustment tool "Color Balance" has to be active automatically.




The every thing opening of the adjustment tools to be automated after
clicking "OK" or "Cancle" button in active dialog box the next
adjustment
tool to be opened automatically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top