Closed Okaghana closed 4 years ago
keyboard
in your function is a local variable, not global. You are passing an empty value for that parameter
SendText(string){
global keyboard ; use keyboard var from global scope
For index, char in StrSplit(string)
{
AHI.SendKeyEvent(keyboard, GetKeySC(%char%), 1)
AHI.SendKeyEvent(keyboard, GetKeySC(%char%), 0)
}
}
That doesn't fix the error. I still get
0x80004002 - No such interface supported
Same for passing the keyboard as a function parameter
AHI.SendKeyEvent(keyboard, GetKeySC(%char%), 1)
is also wrong
Function calls (GetKeySC
) are already in "expression syntax", so wrapping char
in % symbols is performing a double dereference
AHI.SendKeyEvent(keyboard, GetKeySC(char), 1)
Also doesn't fix it.
keyboard = AHI.GetKeyboardId(0x03EB, 0xFF02)
should be keyboard := AHI.GetKeyboardId(0x1017, 0xA003)
You were literally setting the variable keyboard
to the text AHI.GetKeyboardId(0x1017, 0xA003)
, not to the value that GetKeyboardId
returns
That fixes is. Thank you!
Hey there. I'm trying to send a string via AHI, but I keep getting error messages. Here is my existing code:
As soon as I run it, the script stops as tells me
, followed by an excerpt from AutoHotInjection.ahk.
The rest of AHI works fine, the examples work without a problem
~Okaghana