Skip to content

Commit 552fbd5

Browse files
Merge pull request #3 from AngelsCheeseBurgerOrg/develop
For First Release of "makeamove-site-0.0.1-SNAPSHOT-spring-boot"
2 parents 5268891 + 1b74244 commit 552fbd5

15 files changed

Lines changed: 392 additions & 34 deletions

.classpath

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="src"/>
3+
<classpathentry kind="src" output="target/classes" path="src">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
414
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5-
<classpathentry kind="output" path="bin"/>
15+
<classpathentry kind="output" path="classes"/>
616
</classpath>

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@
2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
/bin/
25+
/target/
26+
/classes/

.project

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@
1010
<arguments>
1111
</arguments>
1212
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
1318
</buildSpec>
1419
<natures>
20+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
1521
<nature>org.eclipse.jdt.core.javanature</nature>
1622
</natures>
1723
</projectDescription>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3+
org.eclipse.jdt.core.compiler.compliance=1.8
4+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5+
org.eclipse.jdt.core.compiler.release=disabled
6+
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

pom.xml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.angelssoftware</groupId>
6+
<artifactId>makeamove-site</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
<name>Make a Move</name>
10+
<description>Dont make your computer Idle</description>
11+
<build>
12+
<sourceDirectory>src</sourceDirectory>
13+
14+
<!-- Automate to create a bat script that writes runnable jar execution -->
15+
<resources>
16+
<resource>
17+
<directory>resources/build</directory>
18+
<filtering>true</filtering>
19+
<includes>
20+
<include>**/run_make_a_move.bat</include>
21+
</includes>
22+
</resource>
23+
<resource>
24+
<directory>resources/build</directory>
25+
<filtering>false</filtering>
26+
<excludes>
27+
<exclude>**/run_make_a_move.bat</exclude>
28+
</excludes>
29+
</resource>
30+
</resources>
31+
32+
<plugins>
33+
34+
<!-- Always clean project first -->
35+
<plugin>
36+
<artifactId>maven-clean-plugin</artifactId>
37+
<version>2.4.1</version>
38+
<configuration>
39+
<filesets>
40+
<fileset>
41+
<directory>target</directory>
42+
</fileset>
43+
</filesets>
44+
</configuration>
45+
</plugin>
46+
47+
<!-- Source code Compiler -->
48+
<plugin>
49+
<artifactId>maven-compiler-plugin</artifactId>
50+
<version>3.7.0</version>
51+
<configuration>
52+
<source>1.8</source>
53+
<target>1.8</target>
54+
</configuration>
55+
</plugin>
56+
57+
<!-- Create Executable/Runnable Jar file as a release process -->
58+
<plugin>
59+
<groupId>org.springframework.boot</groupId>
60+
<artifactId>spring-boot-maven-plugin</artifactId>
61+
<version>2.3.4.RELEASE</version>
62+
<executions>
63+
<execution>
64+
<goals>
65+
<goal>repackage</goal>
66+
</goals>
67+
<configuration>
68+
<classifier>spring-boot</classifier>
69+
<mainClass>
70+
org.angelssoftware.MakeaMove
71+
</mainClass>
72+
</configuration>
73+
</execution>
74+
</executions>
75+
</plugin>
76+
77+
<!--
78+
Try to Auto generate the script batch file to execute
79+
the Runnable Jar
80+
-->
81+
<plugin>
82+
<groupId>org.apache.maven.plugins</groupId>
83+
<artifactId>maven-resources-plugin</artifactId>
84+
<version>3.0.2</version>
85+
<executions>
86+
<execution>
87+
<id>copy-resources</id>
88+
<phase>validate</phase>
89+
<goals>
90+
<goal>copy-resources</goal>
91+
</goals>
92+
<configuration>
93+
<outputDirectory>${basedir}/target/</outputDirectory>
94+
<resources>
95+
<resource>
96+
<directory>${basedir}/target/classes/</directory>
97+
<includes>
98+
<include>run_make_a_move.bat</include>
99+
</includes>
100+
<filtering>true</filtering>
101+
</resource>
102+
</resources>
103+
</configuration>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
</plugins>
108+
</build>
109+
110+
<developers>
111+
<developer>
112+
<id>ryanseth</id>
113+
<name>Ryan Seth Roldan</name>
114+
<email>ryan.s.roldan@gmail.com</email>
115+
<organization>Angels Software</organization>
116+
</developer>
117+
</developers>
118+
119+
<dependencies>
120+
<dependency>
121+
<groupId>args4j</groupId>
122+
<artifactId>args4j</artifactId>
123+
<version>2.33</version>
124+
</dependency>
125+
</dependencies>
126+
<url>https://github.com/AngelsCheeseBurgerOrg/MakeaMove</url>
127+
<organization>
128+
<name>Angels Software Org</name>
129+
<url>https://github.com/AngelsCheeseBurgerOrg</url>
130+
</organization>
131+
</project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo ON
2+
"${java.home}\\bin\java" -jar ${project.build.finalName}-spring-boot.jar -mouse-direction UP -execution-period 20000 -mouse-hop-px 1
3+
4+
@pause

src/org/angelssoftware/MakeaMove.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
package org.angelssoftware;
22

3-
import java.awt.AWTException;
4-
53
import org.angelssoftware.classes.MousePointerMover;
64
import org.angelssoftware.classes.RobotAutomation;
75
import org.angelssoftware.models.ApplicationArgumentModel;
8-
import org.angelssoftware.structures.MoveDirection;
96

107
public class MakeaMove {
118

129
public static void main(String[] args) {
1310
ApplicationArgumentModel applicationArgumentModel = new ApplicationArgumentModel(args);
1411
performASimpleMove(applicationArgumentModel);
1512
}
16-
1713

1814
private static void performASimpleMove(ApplicationArgumentModel applicationArgumentModel) {
1915
try {
20-
applicationArgumentModel.setTimeDelayInMillis(1000);
21-
2216
MousePointerMover mousePointer = new MousePointerMover(applicationArgumentModel);
23-
mousePointer.setMoveDirection(MoveDirection.DOWN);
24-
mousePointer.setMouseHopInPx(3);
25-
2617
RobotAutomation robotAutomation = new RobotAutomation(applicationArgumentModel);
2718
robotAutomation.addRobotAction(mousePointer);
2819
robotAutomation.runRobotActions();

src/org/angelssoftware/classes/MousePointerMover.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package org.angelssoftware.classes;
22

33
import java.awt.AWTException;
4-
import java.awt.Dimension;
54
import java.awt.MouseInfo;
65
import java.awt.Point;
76
import java.awt.Robot;
8-
import java.awt.Toolkit;
97

108
import org.angelssoftware.interfaces.RobotActionInterface;
119
import org.angelssoftware.interfaces.RobotMouseInterface;
1210
import org.angelssoftware.models.RobotProperties;
11+
import org.angelssoftware.structures.ScreenSize;
1312

1413
public class MousePointerMover extends RobotProperties implements RobotActionInterface, RobotMouseInterface{
1514
private int maxHeight;
@@ -27,9 +26,9 @@ public MousePointerMover(RobotMouseInterface robotProperties) throws AWTExceptio
2726
}
2827

2928
private void commonInitialization() throws AWTException {
30-
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
31-
setMaxHeight(screenSize.height);
32-
setMaxWidth(screenSize.width);
29+
ScreenSize screenSize = ScreenSize.getInstance();
30+
setMaxHeight(screenSize.getMaxHeight());
31+
setMaxWidth(screenSize.getMaxWidth());
3332
setLocalRobot(new Robot());
3433
}
3534

@@ -91,4 +90,9 @@ private Robot getLocalRobot() {
9190
private void setLocalRobot(Robot localRobot) {
9291
this.localRobot = localRobot;
9392
}
93+
94+
@Override
95+
public String toString() {
96+
return "Screensize: x=" + getMaxWidth() + ", y=" + getMaxHeight();
97+
}
9498
}

src/org/angelssoftware/classes/RobotAutomation.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ public void runRobotActions() {
2121
Timer timer = new Timer();
2222

2323
//delay - delay in milliseconds before task is to be executed.
24-
long delay = applicationArgumentModel.getTimeDelayInMillis();
24+
long delay = 100;
2525
//period - time in milliseconds between successive task executions.
26-
long period = 1000; //applicationArgumentModel.getTimeDelayInMillis();
26+
long period = applicationArgumentModel.getTimeDelayInMillis();
2727

28-
TimerTask timerTask = new TimerTask() {
29-
@Override
30-
public void run() {
31-
for(RobotActionInterface robotIf : listRobotActions) {
32-
robotIf.action();
33-
}
34-
}
35-
};
36-
37-
timer.schedule(timerTask, delay, period);
28+
TimerTask timerTask = new TimerTask() {
29+
@Override
30+
public void run() {
31+
for(RobotActionInterface robotIf : listRobotActions) {
32+
robotIf.action();
33+
}
34+
}
35+
};
36+
37+
timer.schedule(timerTask, delay, period);
3838
}
3939

4040

0 commit comments

Comments
 (0)