.NET components

rhnavcrhnavc Member Posts: 11
Hi,

I'm struggling to find .NET equivalents for current used COM Automations. Any help or hint in the right direction would be very helpful. Currently open .NET equivalents for COM components are:
- Microsoft Scripting Runtime
- Microsoft Shell Controls and Automation
- Microsoft Script Control 1.0
- Microsoft VBScript Regular Expressions 5.5
- Navision Contact Search 1.0

Thanks in advance.

Answers

  • parmparm Member Posts: 49
    Hi,
    It's difficult to suggest a .Net replacement to COM without knowing what you are trying to implement.
    The Microsoft Scripting Runtime can be used to work with files or folder (and other stuff).
    To use files you have one .NET component, to use files you have another.
    My suggestion is to find what features you use from each COM and find the correct .NET component to use.

    Regards,
    parm
  • AntidotEAntidotE Member Posts: 61
    I agree with @parm - there is no strict .NET replacement for Automations. Functions are spread all around.
    It is hard to swim against self bloodstream... (c) Old, experienced kamikadze.
  • rhnavcrhnavc Member Posts: 11
    My apologies if I asked the wrong way. I'll try to be more specific this time. I'm looking for .NET equivalents for the 'Windows Script Host Object Model' COM component and its WshShell, IWshExec, WshNetwork and IWshCollection classes.

    C/AL examples:
    WshShell.SendKeys(Parameter);
    EXIT(WshShell.RegRead(Parameter));
    EXIT(WshShell.AppActivate(Parameter));
    WshExec := WshShell.Exec(Parameter);
    EXIT(WshShell.Run(Parameter));
    EXIT(WshExec.Status);
    WshCollection := WshNetwork.EnumNetworkDrives;;
    EXIT(WshCollection.Count);

    Would appreciate any help/hint in the right direction.
  • parmparm Member Posts: 49
  • DuikmeesterDuikmeester Member Posts: 304
    edited 2016-04-15
    How about just doing DriveInfo.GetDrives.

    On hindside this only works for physical drives :neutral:
  • kylehardinkylehardin Member Posts: 257
    For Drives, and for file manipulation in general , the File System Object has a lot of functions.

    Name DataType Subtype Length
    FSODirectory DotNet System.IO.Directory.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    FSOArray DotNet System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    FSOFile DotNet System.IO.File.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    FSOPath DotNet System.IO.Path.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    Keep in mind that you need to be aware of where your new DotNet calls will execute. By default, they will be on your NAV service tier, not your client, though you can control where they run. When you define a dotnet variable, take a look at its properties and make sure to set RunOnClient as appropriate.
    Kyle Hardin - ArcherPoint
  • rhnavcrhnavc Member Posts: 11
    Thank you all for your input and sorry for my late feedback. I managed to find some .NET alternatives and put them to work, but on the other hand am still missing some.
  • mdPartnerNLmdPartnerNL Member Posts: 802
    want to share some examples?
  • RefaeliadriaRefaeliadria Member Posts: 1
    I am very happy to read your about the .net framework component. One point in this article is not clear in terms practicle senario in my mind that is Comman type specification. Please provide good practicle example in terms of different languages so i clears .
  • rhnavcrhnavc Member Posts: 11
    kylehardin wrote: »
    For Drives, and for file manipulation in general , the File System Object has a lot of functions.

    Name DataType Subtype Length
    FSODirectory DotNet System.IO.Directory.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    FSOArray DotNet System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    FSOFile DotNet System.IO.File.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    FSOPath DotNet System.IO.Path.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    Keep in mind that you need to be aware of where your new DotNet calls will execute. By default, they will be on your NAV service tier, not your client, though you can control where they run. When you define a dotnet variable, take a look at its properties and make sure to set RunOnClient as appropriate.

    Hy Kyle,

    I tried to implement the "Path" Assembly in NAV 2009 and run it the classic client:

    ReturnText := Path.GetFullPath(p_Text);
    MESSAGE(ReturnText);

    but at runtime I get the following error:

    The .NET interop type cannot be used in code for the Classic CSide runtime.

    The variable is set to RunOnClient = Yes.
  • kylehardinkylehardin Member Posts: 257
    DotNet variables can only be used in RTC.
    Kyle Hardin - ArcherPoint
  • NtgNtg Member Posts: 5
    Hello, does anybody know if there is a .NET assembly equivalent to the MS Script Control 1.0. COM component?

    I need to map the ScriptControl.Language and ScriptControl.Eval methods to any equivalent .NET methods.

    CREATE(MSScriptControl,FALSE,TRUE) ;
    MSScriptControl.Language('VBScript');
    vResult := MSScriptControl.Eval(Formula);
Sign In or Register to comment.