Neue Testversion 20.40b12
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
Re: Neue Testversion 20.40b12
Not here.
When I run the PhotoLineScriptD from the Scripts sub-menu, nothing happens. When I close the image and close PL, PL continues running as a background process. I must use Task Manager to kill it.
The same is true for the ExportWeb DLL that comes with PLbeta12.
Perhaps your development version of PL has some different code than the released beta12?
Also, why would your PhotoLineScriptD.DLL have an entry point but my DLLtest01.DLL not have one? The code defining the DllExport function seems to be the same and both were compiled with VS2017. Is there another hidden setting in VS that I'm missing when setting up the solution in VS?
When I run the PhotoLineScriptD from the Scripts sub-menu, nothing happens. When I close the image and close PL, PL continues running as a background process. I must use Task Manager to kill it.
The same is true for the ExportWeb DLL that comes with PLbeta12.
Perhaps your development version of PL has some different code than the released beta12?
Also, why would your PhotoLineScriptD.DLL have an entry point but my DLLtest01.DLL not have one? The code defining the DllExport function seems to be the same and both were compiled with VS2017. Is there another hidden setting in VS that I'm missing when setting up the solution in VS?
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
-
- Entwickler
- Posts: 4174
- Joined: Mon 18 Nov 2002 15:30
- Location: Bad Gögging
Re: Neue Testversion 20.40b12
PhotoLineScriptD and Export are the same. What they do, is nothing, when you have a document without "correct" layer names.
the only thing I know, is that the nuget package has to be installed. I am no expert in such things. I installed it with the command line, like explaint on the web site of the package.photoken wrote:Also, why would your PhotoLineScriptD.DLL have an entry point but my DLLtest01.DLL not have one? The code defining the DllExport function seems to be the same and both were compiled with VS2017. Is there another hidden setting in VS that I'm missing when setting up the solution in VS?
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
Re: Neue Testversion 20.40b12
But the layer name is "Jill".Gerhard Huber wrote: ↑Tue 25 Jul 2017 11:24 PhotoLineScriptD and Export are the same. What they do, is nothing, when you have a document without "correct" layer names.
'I used the NuGet Package Manager "Manage NuGet Packages for Solution" GUI, and the DllExport package is listed as being installed for the solution. There is still the question of why one set of code does not create an entry point and the other solution does create an entry point.Gerhard Huber wrote: ↑Tue 25 Jul 2017 11:24 the only thing I know, is that the nuget package has to be installed. I am no expert in such things. I installed it with the command line, like explaint on the web site of the package.
Very confusing....
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
-
- Entwickler
- Posts: 4174
- Joined: Mon 18 Nov 2002 15:30
- Location: Bad Gögging
Re: Neue Testversion 20.40b12
yes, "Jill" does nothing, because there is no filename.photoken wrote: ↑Tue 25 Jul 2017 11:34But the layer name is "Jill".Gerhard Huber wrote: ↑Tue 25 Jul 2017 11:24 PhotoLineScriptD and Export are the same. What they do, is nothing, when you have a document without "correct" layer names.
for me, too.photoken wrote: ↑Tue 25 Jul 2017 11:34'I used the NuGet Package Manager "Manage NuGet Packages for Solution" GUI, and the DllExport package is listed as being installed for the solution. There is still the question of why one set of code does not create an entry point and the other solution does create an entry point.Gerhard Huber wrote: ↑Tue 25 Jul 2017 11:24 the only thing I know, is that the nuget package has to be installed. I am no expert in such things. I installed it with the command line, like explaint on the web site of the package.
Very confusing....
Perhaps I can find the problem, if you would send me your whole project.
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
Re: Neue Testversion 20.40b12
OK, now I understand how it should work, and the ExportWeb DLL does work here.
But, it leaves a PL background process running when PL is closed.
Here is what I did:
- Open a JPG image.
- Duplicate the background layer 3 times, naming those layers as shown:
- Run ExportWeb from the Scripts sub-menu.
- Close the JPG image, answering "No" to the prompt to save it.
- Close PL.
You do not have the required permissions to view the files attached to this post.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
-
- Entwickler
- Posts: 4174
- Joined: Mon 18 Nov 2002 15:30
- Location: Bad Gögging
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
Re: Neue Testversion 20.40b12
I would very much appreciate that. Sorry to be such a pain....Gerhard Huber wrote: ↑Tue 25 Jul 2017 13:25for me, too.
Perhaps I can find the problem, if you would send me your whole project.
The solution is attached.
You do not have the required permissions to view the files attached to this post.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
-
- Entwickler
- Posts: 4174
- Joined: Mon 18 Nov 2002 15:30
- Location: Bad Gögging
Scripting DLL
To avoid problems with scripts in dll format, the main function should look like this:
Code: Select all
[DllExport("Main", CallingConvention = CallingConvention.Cdecl)]
public static void Main()
{
try
{
Export(); // the function to call
}
catch
{
}
GC.Collect();
}
-
- Entwickler
- Posts: 4174
- Joined: Mon 18 Nov 2002 15:30
- Location: Bad Gögging
Scripting DLL C#
I had a look on your project.
There is something missing about NuGet package "UnmanagedExports".
I removed the package from your project. Then quit Visual Studio. Start it again, open the NuGet console and write:
Install-Package UnmanagedExports -Version 1.2.7
After this, the package was installed here correct and the dll has now an entry point.
There is something missing about NuGet package "UnmanagedExports".
I removed the package from your project. Then quit Visual Studio. Start it again, open the NuGet console and write:
Install-Package UnmanagedExports -Version 1.2.7
After this, the package was installed here correct and the dll has now an entry point.
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
Re: Scripting DLL
Yes, that makes sense -- I had to do something similar when writing an AddIn as a compiled Windows Forms executable. I found that I needed to call the Dispose() method of the form when closing the AddIn.Gerhard Huber wrote: ↑Wed 26 Jul 2017 10:57 To avoid problems with scripts in dll format, the main function should look like this:
...
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
Re: Scripting DLL C#
Thank you very much for looking at this.Gerhard Huber wrote: ↑Wed 26 Jul 2017 13:30 I had a look on your project.
There is something missing about NuGet package "UnmanagedExports".
I removed the package from your project. Then quit Visual Studio. Start it again, open the NuGet console and write:
Install-Package UnmanagedExports -Version 1.2.7
After this, the package was installed here correct and the dll has now an entry point.
I will be working on getting a DLL working here, but I have a couple of questions right now:
- When you run the DLL, do you get a Windows form that displays the MessageBox when the "OK" button is clicked?
- If so, would you post your compiled DLL here, please?
- Are you using VS2015? I suspect that the UnmanagedExports 1.2.7 package does not work with VS2017. If my experiments prove that, then I'll need to try the newer DllExport package that is being maintained by "3F"....
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
-
- Entwickler
- Posts: 4174
- Joined: Mon 18 Nov 2002 15:30
- Location: Bad Gögging
Re: Scripting DLL C#
I select the entry in the menu. The message box appears, I click OK and it disappears.
I append it.
I tried it with both versions of Visual Studio. Both work the same way here. I have 1.2.7 and there is no problem on VS2017.
You do not have the required permissions to view the files attached to this post.
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
Re: Scripting DLL C#
OK, thank you very much, again! Also, thanks for the compiled DLL.Gerhard Huber wrote: ↑Thu 27 Jul 2017 07:30 I tried it with both versions of Visual Studio. Both work the same way here. I have 1.2.7 and there is no problem on VS2017.
This gives me some hope that I can somehow get the DLL thing working....
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
Re: Scripting DLL C#
I give up.
The compiled DLL you posted here works as you described.
So, I created a new Class Library project, used the NuGet console to install the UnmanagedExports 1.2.7, copied the Form1.cs code to this new project, and compiled it for the x64 platform. The &$@$# thing does nothing when run from PL.
Ahhhhh!
I found the problem -- I do all my work on this computer while logged in as a Standard User account. When running VS2017 in that account, the NuGet console shows that the UnmanagedExports package was installed (and VS2017 uses its methods as expected), but the UnmanagedExports installation is actually half-assed.
The solution is to run VS2017 as an administrator. UnmanagedExports installs properly, and compiling the code gives a DLL that does work.
Whew!
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
-
- Mitglied
- Posts: 2162
- Joined: Sat 28 Sep 2013 01:25
AddIn DLL C#
Just a quick update on my DLL experimentation --
And I've attached the compiled DLL to demonstrate its behavior.
- I'm using the DllExport tool maintained here:
https://github.com/3F/DllExport
because it seems that this is the exporting tool that will be maintained and updated, going forward. - That tool automatically compiles x86 and x64 versions of the DLL.
- I figured out how to display the WinForm GUI in a DLL!
Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Resources;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DLLMessageBox01 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
[DllExport("Main", CallingConvention.Cdecl)]
static void DisplayGUI() {
Form1 GUIForm = new Form1();
GUIForm.Show();
}
static void ShowMessage() {
string message = "Hello World!\n(again)";
string titletext = "Test";
MessageBox.Show(message, titletext, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
public static void CloseAddin() {
Form1.ActiveForm.Dispose();
}
private void buttonOK_Click(object sender, EventArgs e) {
try {
ShowMessage();
} catch (Exception appe) {
MessageBox.Show(appe.InnerException.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
throw;
} finally {
CloseAddin();
}
}
}
}
You do not have the required permissions to view the files attached to this post.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.