|
For two days, it has been suggested you look at using the Process class.
If you run your script from within a process, you can redirect the stdout and read it within your program.
The other wapproach is in when you launch your process to redirect standard output to a file. Once your script has completed then read in the content of the file.
I will not google this for you, but there is a lot of information about redirecting output and launching processes from C#. Go read up on it, have a try and come back when you hit a wall. NB - that means yoiu have tried for more than five minutes.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hello,
I created a sample.vbs script which has this in it. i.e. Wscript.echo "Hello"
The strOutPut = "Microsoft (R) Windows Script Host Version 5.6\r\nCopyright (C) Microsoft Corporation 1996-2001. All rights reserved.\r\n\r\nHello\r\n"
After reading I have now tried to do the following:
string scriptPath = @"\\" + txtTargetMachine.Text + @"\c$\sample.vbs";
//string scriptPath = @"c:\sample2.vbs";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "cscript.exe";
//proc.StartInfo.FileName = "Wscript.exe";
proc.StartInfo.Arguments = scriptPath;
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
try
{
proc.Start();
}
catch (Exception scriptError)
{
}
proc.WaitForExit();
int exitCode = proc.ExitCode;
string strOutPut = proc.StandardOutput.ReadToEnd();
string strErr = proc.StandardError.ReadToEnd();
proc.Close();
|
|
|
|
|
hi,
i am using for loop and assigning value to a string.the reference of the memory get cleared after exiting the loop but the memory exits ,so I wanna clear heap memory without using Garbage collection within the loop.
Reply soon.
Thanks in advance.
|
|
|
|
|
rajeshsha18 wrote: so I wanna clear heap memory without using Garbage collection within the loop
And how would you expect this to work? Strings are managed resources, so are subject to being tidied up by the Garbage Collector. Without using an unmanaged string, I couldn't see an easy way to satisfy this requirement. What could you possibly be doing that you wouldn't want to rely on the GC here?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Why do you want to do this? Garbage collection takes care of itself, so its something you rarely want to get involved with.
Regards,
Rob Philpott.
|
|
|
|
|
rajeshsha18 wrote: without using Garbage collection
Do you mean without waiting for garbage collection?
You can call GC.Collect()[^] to force a collection.
Read Rico's guide to When to call GC.Collect()[^] first though. Generally calling GC.Collect() is a bad idea, you are much better off just letting the GC handle itself.
Simon
|
|
|
|
|
HI I am developing a project in c# desktop in which i want editor like
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/HTMLEditor/HTMLEditor.aspx[^][^]
It is in web but i want same in desktop, do any have done that before.
regards
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Your question is not very clear.
As always the big question from here is what have you tried so far?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I mean what htmleditor available in web , want c# desktop application.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Have you looked at the RichTextBox control? It's a reasonably well-featured control that's capable of some of the wizadry you'd normally expect from a word-processor.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
My original thought was RichText, I was just trying to pre-empt the 'why isn't the output in HTML' question tomorrow afternoon.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
|
I read the following from one news:http://infoworld.com/print/79216
Silverlight 3 applications can run in or out of the browser, online or offline.
If so, WPF will be throwed away? It seems not, but if Silverlight 3 can be run in or out of the browser,
why WPF will be chosen?
thanks
|
|
|
|
|
Seraph_summer wrote: If so, WPF will be throwed away?
Unless they fix it in VS2010, it will be thrown away anyway.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Seraph_summer wrote: I read the following from one news:http://infoworld.com/print/79216
Silverlight 3 applications can run in or out of the browser, online or offline.
If so, WPF will be throwed away? It seems not, but if Silverlight 3 can be run in or out of the browser,
why WPF will be chosen?
You really shouldn't have asked this in this forum, but I'll answer it anyway.
Basically, Silverlight OOB is still only Silverlight. In other words, it has the same limitations that apply when Silverlight runs inside a browswer. This means that it runs inside the browser sandbox, and so cannot interact with the file system as a whole for instance. Silverlight does not have the full power of WPF, which supports a much more feature rich API than Silverlight, and implements features that are still missing from Silverlight, e.g. IDataErrorInfo.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Seraph_summer wrote: Silverlight 3 applications can run in or out of the browser, online or offline.
If so, WPF will be throwed away? It seems not, but if Silverlight 3 can be run in or out of the browser, why WPF will be chosen?
Few years ago, someone introduced something we now call "Flash". Those things can run in a browser, and outside of it. Silverlight isn't a replacement for WPF, just as WPF wasn't a replacement for MFC. We're talking different technologies, each with it's own merits and problems.
Even COBOL hasn't been thrown away yet. There's only one technology that comes to mind that should be actively replaced so it can be thrown out: VB6
I are troll
|
|
|
|
|
hi
i developed a software , and i made a setup of the project
and the setup installation default path is
c:\ProgramFiles\[Manufacture]\[Company Name]\[Project Name]\
in this path my software is installed
in my project i need to
1)write the input values given by user in a text file
2)update the Ms acess Database
3)save a image
now when the user runs the software
it is giving the error message
"Access to the File inputs.txt is denied"
since there is no permission to user to read and write a file
in c:\\
even i cannot modify a dotnet source in c:\\ drive
please help me
how to solv e this problem
regards
vijaykumar D
|
|
|
|
|
I do not know the answer to your problem but I think it would help others to assist you if you edit your post to say what OS you are referring to.
I assume you are using Vista, but that might not be so.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hi
its not vista
and i think it is not OS dependent
the problem is with permissions restricted by Administrator
i given full permission to my user account in my PC
it is working fine
but the Admin of my client can refuse to give full control for C:\\ drive
as it is against the security rules
One of the Admin of my client refused to give the permissions bcoz the softwares developed by third party are running successfully with any permissions given by the Admin
i didnt observe OS since i have so many users but no one is using vista in my company
thank you for u r reply
|
|
|
|
|
hi
i get the following error message at run time
System.Security.SecurityException: Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
|
|
|
|
|
As I said in my first post, I do not have an answer to your problem.
However, if the cause of the difficulty is rules of the systems administrators at your various clients, you must find a strategy to accommodate these rules.
All of these clients MUST have a location on their network where databases are allowed both read and write access, otherwise those companies simply couldn't do any work. What you have to do is find out what that location is for those sites and identify a way to allow installation to the correct place.
As far as writing user input is concerned, the solution will depend on whether that input needs to be seen by all users or just the user that made the input. For all user access, store it in a DB at the location identified above. For access on a peruser basis take a look at the documentation for Environment.SpecialFolder to see if anything there meets your needs.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I am doing a sample program to test "managed and unmanaged interoperability". I have a c++ function which takes vector and gives me some result back. This vector i want to pass from c# program. Can any one of you please let me know, the C# Equivalent of a C++ std::vector? If possible please provide me some sample code. Thanks in adavance.
Regards,
Srikanth.
sree
|
|
|
|
|
There is nothing you can pass from C# that is going to turn into a std::vector. Your best bet, IMO, is to pass a list into a C++/CLI dll, which constructs a vector and pases it to your function.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
sree wrote: C# Equivalent of a C++ std::vector?
It would be List(T)[^].
sree wrote: This vector i want to pass from c# program.
I don't think you can create a vector and pass to the native function. Best method would be to use C++/CLI to wrap the native function. Write a function which takes a managed list in the C++/CLI class. Inside this function, create a std::vector with the values from list and pass to the native method. You can refer the C++/CLI project's DLL and call the methods from C# easily.
|
|
|
|
|
Thanks for your inputs.
But when i am trying to pass List<>, it giving me the fallowing exception
"Cannot marshal 'parameter #1': Generic types cannot be marshaled".can you plz tell me how to pass the list to c++.
sree
|
|
|
|