PsDotNet - Photoshop C# library

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: xbytor, DavideBarranca, Paul MR

polyxgo
Posts: 1
Joined: Fri Dec 22, 2017 2:15 pm

Re: PsDotNet - Photoshop C# library

Postby polyxgo » Fri Dec 22, 2017 2:23 pm

Hi davidwright ,
Nice to meet you here!
I'm use your PsDotNet.dll everything OK with my application but have only one problem with my when call function .Close().
This function working ok with Photoshop CS6... but throw a exception with CC2017, CC2018.
My application need to close all documents and layers after processed done! So, this function is very important for performance!

Your can help check this exception below? Thanks you so much and this library is awesome when interact to Photoshop

************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- The object "document 0" is not currently available.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Photoshop.Document.get_id()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
at PsDotNet.Base.Extensions.GetHashCodeOrId(Document document)
at PsDotNet.Base.PsDocument.GetHashCode()
at PsDotNet.Base.Collections.PsDocuments.get_NeedsRefresh()
at PsDotNet.Base.PsApplication.get_Documents()
at PsDotNet.Base.PsApplication.Open(String filePath, Boolean asSmartObject, Object asType)
//----
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

davidwright
Posts: 4
Joined: Fri Jan 13, 2017 7:56 am

Re: PsDotNet - Photoshop C# library

Postby davidwright » Tue Dec 26, 2017 7:30 pm

Hey Polyxgo,
Please try the solution I posted in Slack workspace.

**Information on how to join PsDotNet Slack can be found on the website.

sandy154
Posts: 1
Joined: Mon Apr 30, 2018 1:28 pm

Re: PsDotNet - Photoshop C# library

Postby sandy154 » Mon Apr 30, 2018 1:35 pm

i need to convert .psd file to png using photoshop.dll in .net platform but without opening photoshop image textlayer is not updating.below is the code.
string adobejavascriptfilepath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Scripts\\AdobeScript.jsx");
dynamic app = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));
here photoshop is opening.
is there an way i can perform the task without opening the photoshop.


Return to “Photoshop Scripting - General Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests