'Windows Script Host Object Model'.WshShell .NET

AlexPWS
Member Posts: 14
Does anybody know if there is a .NET assembly equivalent to the 'Windows Script Host Object Model'.WshShell. component?
I'd appreciate any suggestion. Thanks.
I'd appreciate any suggestion. Thanks.
0
Answers
-
I also tried long back but couldn't find something similar.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
Hello @AlexPWS
Here are the variables:Name DataType Subtype Length WShell DotNet System.Diagnostics.Process.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ProcInfo DotNet System.Diagnostics.ProcessStartInfo.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' StreamReader DotNet System.IO.StreamReader.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TextReader DotNet System.IO.TextReader.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Lin Text
And this is the code to the equivalent Shell in .NET:dotNetShell(Program2Call : Text[1024];Parameters : Text[1024];Mode : 'Silence,Text,Stream') ProcInfo := ProcInfo.ProcessStartInfo; ProcInfo.FileName := Program2Call; ProcInfo.Arguments := Parameters; ProcInfo.UseShellExecute := FALSE; ProcInfo.RedirectStandardOutput := TRUE; ProcInfo.WindowStyle := 1; // Hidden, ProcInfo.CreateNoWindow := TRUE; WShell:= WShell.Start(ProcInfo); IF Mode <> Mode::Silence THEN BEGIN IF (Mode = Mode::Texto) THEN BEGIN TextReader := WShell.StandardOutput; Lin := TextReader.ReadToEnd; MESSAGE(Lin); END ELSE BEGIN StreamReader := WShell.StandardOutput; WHILE NOT StreamReader.EndOfStream DO BEGIN Lin := StreamReader.ReadLine; MESSAGE(Lin); END; END; END; WShell.WaitForExit;
Regards0 -
@ftornero - This solution could come up as a work around, with Automation Windows Host Object it's merely a 2 3 lines of code which does the job.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions