Page 1 of 1

Hotstrings Not Working - AHK_H and Autohotkey.Interop

Posted: 06 Jul 2017, 14:24
by The_Wildry_Dude
Hi Everyone -

I've been trying to port my code over to vb.net, and I while I got some functionality working with the Autohotkey.dll, I can't seem to get hotstrings to work.

Here's the little sample of a WinForms project. I have it loading the script on the button press. This is working:

Code: Select all

Imports AutoHotkey.Interop

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim ahk As AutoHotkeyEngine
        ahk = AutoHotkeyEngine.Instance
        Dim str As String = "F2::MsgBox Success"
        ahk.ExecRaw(str)
    End Sub
End Class
However, when I try the following code it doesn't do the replacement.

Code: Select all

Imports AutoHotkey.Interop

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim ahk As AutoHotkeyEngine
        ahk = AutoHotkeyEngine.Instance
        Dim str As String = "::btw::By the way"
        ahk.ExecRaw(str)
    End Sub
End Class
Other information:

I'm using the dlls provided here https://github.com/amazing-andrew/AutoHotkey.Interop. I also tried replacing the Autohotkey.dll from a more recent build of AHK_H, but I got the same result.

Re: Hotstrings Not Working - AHK_H and Autohotkey.Interop

Posted: 12 Jul 2017, 12:43
by The_Wildry_Dude
Anyone? Any assistance that could be provided would be awesome :)

Re: Hotstrings Not Working - AHK_H and Autohotkey.Interop

Posted: 12 Jul 2017, 14:33
by HotKeyIt
Try using LoadScript instead of ExecRaw!

Re: Hotstrings Not Working - AHK_H and Autohotkey.Interop

Posted: 12 Aug 2017, 02:49
by avitiw
It works if I have a hotkey before defining hotstrings. Could someone tell how to resolve it?

Re: Hotstrings Not Working - AHK_H and Autohotkey.Interop

Posted: 12 Aug 2017, 02:57
by HotKeyIt
Try using #InstallKeybdHook in initial script.