Hello,
So I am trying to port the AutoItX4Java to B4J, because there are a few functions I need, and also because I think that it would be very useful for the community. I have never written code in Java, so I am bumping into problems.
This is my code (I am just testing with the CDTray function):
I built this code from the code provided by Agraham in the jDotNetBridge thread.
I get an error when I compile to a library (using the Simple library compiler):
I can understand that I am trying to merge a library already merged, but I don't know where it has been merged before.
I also based myself on this code:
https://code.google.com/p/autoitx4java/
And this one:
https://stackoverflow.com/questions/11257784/java-with-autoit-and-jacob-library
and this:
http://letusautomatetest.blogspot.com/2012/08/ie-browser-pop-up-handling-to-support.html
If anyone could help, that would be very nice! I actually just need the WinGetState function from autoit, but I am trying to port the whole library for the community.
Thanks.
[edit] I uploaded the project to a zip file.
So I am trying to port the AutoItX4Java to B4J, because there are a few functions I need, and also because I think that it would be very useful for the community. I have never written code in Java, so I am bumping into problems.
This is my code (I am just testing with the CDTray function):
B4X:
package anywheresoftware.autoitx4b4j;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import java.io.File;
import java.lang.System;
import com.jacob.com.LibraryLoader;
import autoitx4java.AutoItX;
/**
*info here
*/
@Version(1.0f)
@ShortName("AutoItX")
public class AutoItX {
// 1.0 initial release
private static final double version = 1.0;
/**
*Returns the version number of the library.
*/
public double getVersion() {
return version;
}
AutoItX x;
/**
*Initialise an instance of AutoitX.
*/
public void Initialize() {
File file = new File("libs", "jacob-1.17-x64.dll"); //path to the jacob dll
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
LibraryLoader.loadJacobLibrary();
x = new AutoItX();
}
/**
* Opens or closes the CD tray.
*Parameters:
*drive: The drive letter of the CD tray to control, in the format D:, E:, etc.
*status: Specifies if you want the CD tray to be open or closed: "open" or "closed"
*/
public void CDTray(String drive, String status) {
x.run(Command); //note: this line is modified in post#3 and should read x.CDTray(drive, status);
}
}
I built this code from the code provided by Agraham in the jDotNetBridge thread.
I get an error when I compile to a library (using the Simple library compiler):
B4X:
Starting step: Compiling Java code.
javac 1.7.0_45
C:\Program Files (x86)\Anywhere Software\Basic4android\SimpleLibraryCompiler\AutoItX\src\anywheresoftware\autoitx4b4j\AutoItX.java:15: error: anywheresoftware.autoitx4b4j.AutoItX is already defined in this compilation unit
import autoitx4java.AutoItX;
^
1 error
Error.
I can understand that I am trying to merge a library already merged, but I don't know where it has been merged before.
I also based myself on this code:
https://code.google.com/p/autoitx4java/
And this one:
https://stackoverflow.com/questions/11257784/java-with-autoit-and-jacob-library
and this:
http://letusautomatetest.blogspot.com/2012/08/ie-browser-pop-up-handling-to-support.html
If anyone could help, that would be very nice! I actually just need the WinGetState function from autoit, but I am trying to port the whole library for the community.
Thanks.
[edit] I uploaded the project to a zip file.
Attachments
Last edited: