diff --git a/src/main/java/com/example/jmacro/wjdr/JMacro.java b/src/main/java/com/example/jmacro/wjdr/JMacro.java index 4150447..a41a86b 100644 --- a/src/main/java/com/example/jmacro/wjdr/JMacro.java +++ b/src/main/java/com/example/jmacro/wjdr/JMacro.java @@ -872,6 +872,15 @@ public abstract class JMacro { return Convert.toBool(result, false); } + /** + * 获取图例 + * + * @return 图例 + */ + public Legend of(String legend) { + return Legend.inflate(legend); + } + /** * 将相对坐标转为绝对坐标 * diff --git a/src/main/java/com/example/jmacro/wjdr/JMainApplication.java b/src/main/java/com/example/jmacro/wjdr/JMainApplication.java index 78f2152..05746f3 100644 --- a/src/main/java/com/example/jmacro/wjdr/JMainApplication.java +++ b/src/main/java/com/example/jmacro/wjdr/JMainApplication.java @@ -1,6 +1,6 @@ package com.example.jmacro.wjdr; -import com.example.jmacro.wjdr.base.ViewPoint; +import com.example.jmacro.wjdr.base.Legend; import com.example.jmacro.wjdr.base.ViewRect; import com.example.jmacro.wjdr.ui.FXMLUtil; import com.example.jmacro.wjdr.util.Logger; @@ -70,13 +70,21 @@ public class JMainApplication extends Application { JMainService.init(new JMacro() { @Override public ViewRect focus() { - return new ViewRect(0, 0, 500, 500); + return new ViewRect(0, 0, 1920, 1080); } @Override public void run() { - findLegend(of(0,0,159,168), "电脑", 0.99); - findLegend(of(100,100,200,200), "电脑2", 0.99); + ViewRect 电脑 = findLegend(of(0, 0, 159, 168), "电脑", 0.99); + if (电脑 == null) { + return; + } + mouseLeftDoubleClick(电脑); + ViewRect 关闭 = waitAndFindLegend(of("关闭"), 0.99, 10); + if (关闭 == null) { + return; + } + mouseLeftClick(关闭); } }, new File("legend")); }