Hotstrings Not Working - AHK_H and Autohotkey.Interop

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
The_Wildry_Dude
Posts: 11
Joined: 17 Aug 2015, 17:15

Hotstrings Not Working - AHK_H and Autohotkey.Interop

Post by The_Wildry_Dude » 06 Jul 2017, 14:24

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.
The_Wildry_Dude
Posts: 11
Joined: 17 Aug 2015, 17:15

Re: Hotstrings Not Working - AHK_H and Autohotkey.Interop

Post by The_Wildry_Dude » 12 Jul 2017, 12:43

Anyone? Any assistance that could be provided would be awesome :)
HotKeyIt
Posts: 1696
Joined: 29 Sep 2013, 18:35
Contact:

Re: Hotstrings Not Working - AHK_H and Autohotkey.Interop

Post by HotKeyIt » 12 Jul 2017, 14:33

Try using LoadScript instead of ExecRaw!
avitiw

Re: Hotstrings Not Working - AHK_H and Autohotkey.Interop

Post by avitiw » 12 Aug 2017, 02:49

It works if I have a hotkey before defining hotstrings. Could someone tell how to resolve it?
HotKeyIt
Posts: 1696
Joined: 29 Sep 2013, 18:35
Contact:

Re: Hotstrings Not Working - AHK_H and Autohotkey.Interop

Post by HotKeyIt » 12 Aug 2017, 02:57

Try using [docs]#InstallKeybdHook[/docs] in initial script.
Post Reply

Return to “AutoHotkey_H”