上传备份

master
王兵 1 week ago
parent db9060e7bc
commit 7698a58aae

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="JavaScriptSettings">

@ -30,7 +30,7 @@ public class JMainApplication extends Application {
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("无限工具");
stage.setTitle("芝麻糊的自动工具箱");
stage.setMinWidth(400);
stage.setMinHeight(300);
FXMLLoader mainLoader = FXMLUtil.load("main.fxml");

@ -13,6 +13,7 @@ import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Button;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextArea;
@ -56,6 +57,8 @@ public class JMainController implements Initializable {
@FXML
private Button stop;
@FXML
private CheckBox autoMini;
@FXML
private ToggleGroup runMode;
@FXML
private HBox modeLoop;
@ -86,6 +89,12 @@ public class JMainController implements Initializable {
JMainController.instance = this;
// 控件初始化
boolean autoMiniValue = JProp.getInstance().getBool("autoMini", false);
autoMini.setSelected(autoMiniValue);
autoMini.setOnMouseClicked(event -> {
JProp.getInstance().setBool("autoMini", autoMini.isSelected());
});
String mode = JProp.getInstance().getString("mode", "loop");
ObservableList<Toggle> toggles = runMode.getToggles();
for (Toggle tog : toggles) {
@ -291,6 +300,11 @@ public class JMainController implements Initializable {
return;
}
Logger.info("服务启动成功");
boolean autoMini = JProp.getInstance().getBool("autoMini", false);
if (autoMini) {
JMainApplication.primaryStage.setIconified(true);
}
}
}
}

@ -44,6 +44,10 @@ public class JProp {
return this.props.getStr(key, "").split(",");
}
public boolean getBool(String key, boolean defaultValue) {
return this.props.getBool(key, defaultValue);
}
public int getInt(String key, int defaultValue) {
return this.props.getInt(key, defaultValue);
}
@ -70,6 +74,11 @@ public class JProp {
this.save();
}
public void setBool(String key, boolean value) {
this.props.setProperty(key, String.valueOf(value));
this.save();
}
public void setInt(String key, int value) {
this.props.setProperty(key, String.valueOf(value));
this.save();

@ -38,24 +38,24 @@ public class TaskImpl extends JMacro {
Logger.info("启动图标坐标:{}", launch.getRect().toString());
Logger.info("移动鼠标");
mouseMove(launch.getCenter());
// Logger.info("双击我的电脑");
// mouseLeftDoubleClick(launch);
// Logger.info("等待程序启动中,请稍等...");
// delay(3 * 1000);
//
// Region windows = findLegend("我的电脑窗口", 0.9);
// if (windows == null) {
// Logger.error("我的电脑启动失败");
// return;
// }
// Logger.info("定位到我的电脑窗口");
// Logger.info("移动鼠标");
// mouseMove(windows.getCenter().offset(100,0));
//
// Logger.info("等待1秒后自动关闭");
// delay(1000);
// mouseLeftClick(windows.getCenter().offset(100,0));
//
// Logger.info("结束任务");
Logger.info("双击我的电脑");
mouseLeftDoubleClick(launch);
Logger.info("等待程序启动中,请稍等...");
delay(3 * 1000);
Region windows = findLegend("我的电脑窗口", 0.9);
if (windows == null) {
Logger.error("我的电脑启动失败");
return;
}
Logger.info("定位到我的电脑窗口");
Logger.info("移动鼠标");
mouseMove(windows.getCenter().offset(100,0));
Logger.info("等待1秒后自动关闭");
delay(1000);
mouseLeftClick(windows.getCenter().offset(100,0));
Logger.info("结束任务");
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -13,7 +13,8 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<AnchorPane prefHeight="300.0" prefWidth="600.0" stylesheets="@main.css" xmlns="http://javafx.com/javafx/17.0.2-ea"
<?import javafx.scene.control.CheckBox?>
<AnchorPane prefHeight="350.0" prefWidth="600.0" stylesheets="@main.css" xmlns="http://javafx.com/javafx/17.0.2-ea"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="xyz.wbsite.jmacro.JMainController">
<children>
<Separator layoutY="-1.0" opacity="0.5" prefWidth="200.0" AnchorPane.leftAnchor="0.0"
@ -37,11 +38,27 @@
</VBox.margin>
</HBox>
<HBox alignment="CENTER_LEFT" prefHeight="25.0" prefWidth="200.0">
<children>
<Label contentDisplay="CENTER" prefHeight="25.0" text="开始后自动最小化"/>
<CheckBox fx:id="autoMini" focusTraversable="false">
<HBox.margin>
<Insets left="5.0"/>
</HBox.margin>
</CheckBox>
</children>
<VBox.margin>
<Insets top="3.0" bottom="3.0"/>
</VBox.margin>
</HBox>
<HBox alignment="CENTER_LEFT" prefHeight="25.0" prefWidth="200.0">
<children>
<Label contentDisplay="CENTER" prefHeight="25.0" text="执行模式"/>
<RadioButton mnemonicParsing="false" text="循环" selected="true" userData="loop">
<RadioButton mnemonicParsing="false" text="循环" selected="true" userData="loop" focusTraversable="false">
<HBox.margin>
<Insets left="5.0"/>
</HBox.margin>
@ -49,7 +66,7 @@
<ToggleGroup fx:id="runMode"/>
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" text="定时" toggleGroup="$runMode" userData="timing">
<RadioButton mnemonicParsing="false" text="定时" toggleGroup="$runMode" userData="timing" focusTraversable="false">
<HBox.margin>
<Insets left="5.0"/>
</HBox.margin>
@ -64,14 +81,14 @@
<HBox fx:id="modeLoop" alignment="CENTER_LEFT" prefHeight="25.0" prefWidth="200.0">
<children>
<Label text="每"/>
<TextField fx:id="interval" alignment="CENTER" prefWidth="35.0" promptText="时间" text="60">
<TextField fx:id="interval" alignment="CENTER" prefWidth="35.0" promptText="时间" text="60" focusTraversable="false">
<HBox.margin>
<Insets left="3.0" right="3.0"/>
</HBox.margin>
</TextField>
<Label text="秒执行1次"/>
<Label text="共"/>
<TextField fx:id="times" alignment="CENTER" prefWidth="35.0" promptText="次数" text="1">
<TextField fx:id="times" alignment="CENTER" prefWidth="35.0" promptText="次数" text="1" focusTraversable="false">
<HBox.margin>
<Insets left="3.0" right="3.0"/>
</HBox.margin>
@ -89,7 +106,7 @@
<children>
<Label text="在"/>
<TextField fx:id="timing" prefWidth="150.0" promptText="如8:30:20,9:00"
text="8:30:20,9:00">
text="8:30:20,9:00" focusTraversable="false">
<HBox.margin>
<Insets left="3.0" right="3.0"/>
</HBox.margin>
@ -155,7 +172,7 @@
<AnchorPane layoutX="262.0" layoutY="14.0" prefHeight="250.0" prefWidth="400.0" AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="204.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Label layoutY="4.0" prefHeight="30.0" prefWidth="60.0" text="控制台" AnchorPane.leftAnchor="0.0"
<Label layoutY="4.0" prefHeight="30.0" prefWidth="60.0" text="运行日志" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<padding>
<Insets left="10.0" right="10.0"/>
@ -163,7 +180,7 @@
</Label>
<Separator layoutX="-3.0" layoutY="39.0" opacity="0.5" prefWidth="200.0" AnchorPane.leftAnchor="1.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="30.0"/>
<TextArea fx:id="console" editable="false" layoutX="1.0" layoutY="41.0" prefHeight="270.0"
<TextArea fx:id="console" editable="false" layoutX="1.0" layoutY="41.0" prefHeight="320.0"
style="-fx-background-color: transparent; -fx-focus-color: no; -fx-control-inner-background: transparent;-fx-text-fill: #444444;"
wrapText="true" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="35.0">

Loading…
Cancel
Save

Powered by TurnKey Linux.