Я пытаюсь использовать autoit с Java, поэтому я добавил в свой проект jacob jar и autoitX4. Но я получил эту ошибку:
'Exception in thread "main" com.jacob.com.ComFailException: Can't co-create object
at com.jacob.com.Dispatch.createInstanceNative(Native Method)
at com.jacob.com.Dispatch.<init>(Dispatch.java:101)
at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
at autoitx4java.AutoItX.<init>(AutoItX.java:231)
at net.java.dev.jna.step2_2.Test.main(Test.java:14)'
Вот мой текущий код:
import java.io.File;
import com.jacob.com.LibraryLoader;
import autoitx4java.AutoItX;
import junit.framework.Assert;
public class Test {
public static void main(String[] args) {
File file = new File("./src/test/ressources//jacob-1.17-M2-x64.dll"); // path
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
AutoItX x = new AutoItX();
String notepad = "Untitled - Notepad";
String testString = "this is a test.";
x.run("notepad", "C:/Windows/System32", AutoItX.SW_MAXIMIZE);
x.winActivate(notepad);
x.winWaitActive(notepad);
x.send(testString);
Assert.assertTrue(x.winExists(notepad, testString));
x.winClose(notepad, testString);
x.winWaitActive("Notepad");
x.send("{ALT}n");
Assert.assertFalse(x.winExists(notepad, testString));
}
}
может кто-нибудь помочь мне, пожалуйста, я не могу исправить ошибку