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.
0
Answers
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
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.
For SendKeys try https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys(v=vs.110).aspx
For RegRead try https://msdn.microsoft.com/en-us/library/aa289494(v=vs.71).aspx
For AppActivate try http://www.vbforums.com/showthread.php?688209-AppActivate-and-FindWindow
Try to google the function name and .net to find more information.
regards,
parm
On hindside this only works for physical drives
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.
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);