qq_43077670 2018-10-18 04:25 采纳率: 100%
浏览 649
已结题

哪个大兄弟有sikuli sharp 的教程?留个链接 谢谢

sikuli sharp 包在c#里用,具体的函数我不知道,请教大神

  • 写回答

1条回答 默认 最新

  • threenewbee 2018-10-18 04:39
    关注

    https://github.com/christianrondeau/SikuliSharp
    可能需要科学地上网,我拷贝一段给你

    Yet another implementation of a Sikuli wrapper for using it in .NET.
    
    Why Another Sikuli Wrapper?
    There are already existing wrappers, sikuli-integrator and sikuli4net, but I had trouble running them, they use an additional level of wrapping, they do not seem very active, and especially they used a lot of static classes, which makes it difficult to extend. I then decided to try building an implementation myself.
    
    How to Use
    Check these steps first:
    
    Download Java
    Download Sikuli 1.1.0, then install it - select the option to run scripts from the command line - the file sikuli-scripts.jar must be installed
    Create an environment variable SIKULI_HOME that points to your Sikuli install folder
    Here is a simple example using NUnit:
    
    using(var session = Sikuli.CreateSession())
    {
      var pattern = Patterns.FromFile(@"C:\Patterns\MyPattern.png"); 
      Assert.That(session.Exists(pattern), Is.True);
    }
    You can also simply run a project:
    
    Sikuli.RunProject(@"C:\Projects\MyProject.sikuli");
    How Does it Work
    A SikuliSession launches an instance of the Sikuli interactive script engine using java.exe -jar sikuli-script.jar -i. All commands are sent to the interactive console, and the output is then parsed.
    
    Documentation
    Remember that this library simply wraps Sikuli; the same limitations apply. You can't use your computer while tests are running since Sikuli takes control of the mouse, and patterns may require fine tuning (using similarity).
    
    Sikuli
    The Sikuli object is the main entry point for all operations. It contains two methods:
    
    CreateSession, which returns an ISikuliSession, with which you can execute Sikuli commands
    RunProject which simply runs a .sikuli project and returns the console output
    SikuliSession
    All commands must be run within a ISikuliSession.
    
    using (var session = Sikuli.CreateSession())
    {
      // Execute commands here
    }
    All commands run against the ISikuliSession instance. They also can receive a timeoutSeconds parameter. If left empty, commands will wait "forever".
    
    session.Exists(pattern, timeoutsSeconds = 0f) checks if the pattern exists on the screen
    session.Click(pattern, timeoutsSeconds = 0f) tries to click on the pattern if it exists on the screen
    session.Click(pattern, offset, timeoutsSeconds = 0f) Click to the Point offset distance from the pattern
    session.Wait(pattern, timeoutsSeconds = 0f) tries to click on the pattern if it exists on the screen
    session.WaitVanish(pattern, timeoutsSeconds = 0f) waits for the pattern to disappear from the screen
    session.Type(text) sends the characters to the application; don't forget to double-escape special characters (e.g. "\\n" should be "\\\\n" or @"\\n")
    Patterns
    Creating a pattern from a file path
    
    var pattern = Patterns.FromFile(@"C:\Patterns\MyPattern.png"); 
    You can also specify a similarity (between 0f an 1f)
    
    var pattern = Patterns.FromFile(@"C:\Patterns\MyPattern.png", 0.6f); 
    SikuliRuntime
    If you need more functions, you can create your own. Here is an example:
    
    using(var runtime = Sikuli.CreateRuntime())
    {
      runtime.Start();
    
      var result = runtime.Run(
        @"print ""RESULT: OK"" if exists(""C:\\Patterns\\MyPattern.png"") else ""RESULT: FAIL""",
        "RESULT:",
        0d
        );
    
      Assert.That(result, Is.StringContaining("RESULT: OK"));
    }
    You must print a string that will show up regardless of whether the test succeeded or not. If you don't provide a timeout and the resultPrefix parameter is not printed in the console, the runtime will hang.
    
    Also remember that this sends Jython to the console. Therefore, you must double-escape strings accordingly.
    

    https://philipcaande.wordpress.com/2015/12/07/visual-studio-2015-with-sikulisharp/
    http://doc.sikuli.org/
    https://stackoverflow.com/questions/27837423/sikuli-integrator-c-sharp

    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)