Closed doongjohn closed 2 years ago
What is the procedure type of autonim
and it's parameters? I do not know what the issue would be without that information.
Isn't autonim
a moduleName?
macro exportTo*(moduleName: untyped, procDefs: varargs[untyped]): untyped =
## Takes a module name and symbols, adding them to the proper table internally.
result = newStmtList()
var moduleName = $moduleName
for pDef in procDefs:
result.add newCall("addToCache", pdef, newLit(modulename))
also this is a function signature of send
is\
https://github.com/khchen/wAuto/blob/fa8e642f4d78822bff4b7fad9d33d5ef3be81f34/wAuto/keyboard.nim#L337
proc send*(text: string, raw = false, window = InvalidWindow, attach = false,
restoreCapslock = false) =
...
InvalidWindow
is type of Window* = distinct HWND
and HWND
is just an int
It is i forgot how my API worked. :smile: It errors about HWND so i guess it's the invalid window, you will probably need a better wrapping. It might be the default parameters aswell.
amazing I just changed the default parameter to primitive type and it worked!
proc sendToActiveWindow(
text: string,
raw = false,
window = 0,
attach = false,
restoreCapslock = false
) =
send(text, raw, Window window, attach, restoreCapslock)
Also I guess I found a minimal example of this issue?
type DistInt = distinct int
proc yay(a: DistInt) = discard
exportTo(
moduleName,
yay,
)
const scriptProcs = implNimScriptModule(moduleName)
Yea this is odd since I do have procedures for T: distinct
https://github.com/beef331/nimscripter/blob/master/src/nimscripter/vmconversion.nim#L40
Oh it looks like i forgot to pass the argument, so yea I guess fix coming soon.
I'm trying to make something similar to AutoHotkey by combining
wAuto
andnimscripter
but I can't export the functionserror: