Expect for .NET is a .NET library which ports of expect scripts functionality. The library is distributed under The MIT License.
Source code can be found on GitHub: https://github.com/wiwanek/Expect.NET
The latest version is available on NuGet: https://www.nuget.org/packages/Expect.NET/
Tutorial how to use Expect for .NET: https://github.com/wiwanek/Expect.NET/wiki/Expect.NET-Tutorial
List of blog posts about Expect for .NET: http://blog.iwanek.eu/category/expect-net/
Hi, I’m trying your .dll from VB. It has a few issues because, for example, some functions like “send” are defined multiple times in spawn.cs. So from VB I get this error when trying to use it: http://msdn.microsoft.com/en-us/library/ms235408(v=vs.90).aspx. Can you do something? 😉 Cheers, Michel
Hi!
Sure. I can release version 2.0.0 with removed case sensitive problems. I wasn’t aware that VB is not case-sensitive 😮
Could you send me some code example in VB (something simple like spawning cmd.exe and sending command ‘dir’) so I can test it before release?
Regards,
Wojtek
Hi,
The code below is enough to see the issue. It complains that “send” is ambiguous because declared more than once. The same wouuld happen with “expect” if I was trying to use it!
Thanks, Michel
Imports Expect
Module TestExpect
Sub Main()
Dim MyExpect As New Expect.SpawnCommand(“cmd.exe”)
MyExpect.send(“Dir C:\” & vbCrLf)
End Sub
End Module
Thanks for example. I’m currently working on the 2.0 version where this issue will be addressed.
Version 2.0.0-beta was released: http://blog.iwanek.eu/expect-net-2-0-0-beta-released/
please give it try and let me know if it works for you.
Thank for this new version. It seems to be working fine.
I’ve no more immediate need for it… (!), but I’m sure the need will come back with another project one of these days!
Hello!
Is it possible to just attach Expect to any process? If I do so like
Process proc = Process.Start(“cmd.exe”);
ISession session = Expect.Expect.Spawn(new Expect.ProcessSpawnable(server));
It creates new instance of cmd.exe…
Thank you!
ISession session = Expect.Expect.Spawn(new Expect.ProcessSpawnable(proc));
Sorry, my mistake 😀
Ok, solved 😀 Sorry for spamming.
=>
Process proc = new Process();
proc.StartInfo = new ProcessStartInfo(“cmd.exe”);
ISession session = Expect.Expect.Spawn(new Expect.ProcessSpawnable(proc));
Hi Tom,
Great to see that you found solution.
And great to see that someone is using my work 😉
Thanks for comments!
Wojtek