Like to do "Automation"

Hello,

someone can explaining me the different from "Automation" e "DotNet" variable? And more how I can made an automation, for example I have a DLL and I have registered with gacutil on my server but I can't see when I have created a global variable type automatition.

Comments

  • SeeSharpSeeSharp Member Posts: 19
    edited 2015-11-04
    Automation is the use of an external DLL (as you have) to call exposed mothods / properties for use inside DynamicsNAV.

    DotNet is pretty much what it says on the tin - it exposes the .NET framework itself inside Dynamics NAV.

    As a very simple example:
    myNewBitmap := myAutomationVariable.CreateNewBitMap;
    

    Which always returns you a 10px by 10px black square in C:\TMP\bitmap.bmp

    If you decided you wanted it to be written to C:\NewDirectory\TMP\ with a red square instead and you didn't have the source of the class lib you might recreate the functionality using the DotNet variable type:
    Name	DataType	Subtype	Length
    smallImage	DotNet	System.Drawing.Bitmap.'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'	
    scaledImage	DotNet	System.Drawing.Bitmap.'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'	
    myColour	DotNet	System.Drawing.Color.'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'	
    
    smallImage := smallImage.Bitmap(1, 1);
    smallImage.SetPixel(0, 0, myColour.Red);
    scaledImage := scaledImage.Bitmap(smallImage, 10, 10);
    scaledImage.Save('C:\NewDirectory\TMP\');
    


    With regards to adding your DLL to the global assembly cache, you also needed to register the assembly also. You can do this through the console:
    regasm myDll.dll
    

    Additional options and documentation on MSDN
  • massimopasqualimassimopasquali Member Posts: 82
    ok but if I want to use mydll.dll without register and without ue dotnet. but only Automation, can you write me all steps to fo that?
  • SeeSharpSeeSharp Member Posts: 19
    "without register"ing the DLL?

    I want to go swimming without water. Just doesn't work, does it?

    I've told you the steps to (hopefully) resolve the problem you're currently facing.
  • massimopasqualimassimopasquali Member Posts: 82
    edited 2015-11-05
    Ok thanks I will tray to use, but you have defined the varible dotnet, but my DLL don't have a costruttor, I attached you a zip of DLL.
  • SeeSharpSeeSharp Member Posts: 19
    You asked for the difference between the two variable types so the DotNet variable type related to that part of the question.

    Use regasm to register the DLL and you should see it in Nav under the `Automation` variable type.

    I don't see an attachment, sorry.



Sign In or Register to comment.