This all works, however, the main script defined after the hotkey does not execute.
Code: Select all
#NoEnv
class PipeServer
{
__New(name)
{
this.name := name
this.pipe := DllCall("CreateNamedPipe", "Str", this.name, "UInt", 3, "UInt", 6, "UInt", 1, "UInt", 65536, "UInt", 65536, "Ptr", 0, "Ptr", 0)
}
Connect()
{
DllCall("ConnectNamedPipe", "Ptr", this.pipe, "Ptr", 0)
}
Close()
{
DllCall("CloseHandle", "Ptr", this.pipe)
}
Write(message)
{
StrLen := StrLen(message) * (A_IsUnicode ? 2 : 1)
DllCall("WriteFile", "Ptr", this.pipe, "Str", message, "UInt", StrLen, "Ptr", 0, "Ptr", 0)
}
}
Pipes := []
pipe := New PipeServer("\\.\pipe\fooname")
pipe.Connect()
Pipes.push(pipe)
OnExit(pipe.Close)
MsgBox, "I do Execute"
#n::
pipe_index := 1
pipe := Pipes[pipe_index]
pipe.Write("1")
MsgBox, "This Also Executes when the hotkey is pressed"
Return
MsgBox, "I do not execute"
; This won't execute
Loop {
; main script logic
}
But if I remove the hotkey definition, the main script logic does get executed, but of course then I don't have the HotKey I need. What am I missing?