Design a site like this with WordPress.com
Get started

Expect for .NET

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/

 

10 responses to “Expect for .NET”

  1. 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

    Like

    1. 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

      Like

      1. 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

        Like

      2. Thanks for example. I’m currently working on the 2.0 version where this issue will be addressed.

        Like

      3. 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.

        Like

      4. 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!

        Like

  2. 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!

    Like

    1. ISession session = Expect.Expect.Spawn(new Expect.ProcessSpawnable(proc));

      Sorry, my mistake 😀

      Like

  3. Ok, solved 😀 Sorry for spamming.
    =>
    Process proc = new Process();
    proc.StartInfo = new ProcessStartInfo(“cmd.exe”);

    ISession session = Expect.Expect.Spawn(new Expect.ProcessSpawnable(proc));

    Like

    1. Hi Tom,

      Great to see that you found solution.

      And great to see that someone is using my work 😉

      Thanks for comments!
      Wojtek

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s