I really need some help and I ask for your kind advice.
I have a java program and I want to make a function call from it into the running ahk script. For example running ahk script has some dynamic data that I want to retrieve and use in java program.
I know how to use ahk functions with a passive ahk script, but I have no idea how to interact with an active ahk script.
For testing purposes I made a simple ahk (count.ahk):
Code: Select all
global count
count = 10
^g::
{
returnvalue()
return
}
^t::
{
count++
return
}
returnvalue(){
Msgbox count=%count%
return
}
Code: Select all
import AHK.AhkDllController;
import com.sun.jna.Native;
import com.sun.jna.WString;
public class Test{
public static void main(String args[]) {
AhkDllController.autoHotKeyDll lib = Native.loadLibrary("AutoHotkey", AhkDllController.autoHotKeyDll.class);
lib.ahktextdll(new WString(""));
lib.addFile(new WString(System.getProperty("user.dir") + "\\count.ahk"), 1, 0);
lib.ahkFunction(new WString("returnvalue"));
}
}
What should I do to be able to get "count" value from a running ahk (preferably not a compiled one)?