Send() not working with '{Blind}{Text}'

Issue #99 closed
Winter Laite created an issue

This combination appears to give erroneous output, but throws no errors either at compile time or runtime.

Working AHK code to test:

Run("Notepad.exe")
WinWaitActive("ahk_exe notepad.exe")

MyGui := Gui(, "Send tests")
MyEdit := MyGui.Add("Edit", "w400 h400")
MyBtn1 := MyGui.Add("Button", "x10", "Notepad")
MyBtn2 := MyGui.Add("Button", "x95 yp", "This Edit")

MyBtn1.OnEvent("Click", SendSimple)
MyBtn2.OnEvent("Click", SendToGui)


MyGui.Show()

SendSimple(*) {
    WinActivate("ahk_exe Notepad.exe")
    SendInput("Sincerely,{enter}John Smith")
    Send("`n")
    Send("Another line.`n")
    Send("{Raw}``100`%`n")
    Send("{Blind}{Text}You should see '{Blind}{Text}' after the ellipses ... {Blind}{Text}`n")
    Send("{Blind}You should not see anything after the ellipses ... '{Blind}'`n")
    Send("{Text}You should see the Blind mode syntax after the ellipses ... '{Blind}'")
}

SendToGui(*) {
    WinActivate(MyGui)
    ControlFocus(MyEdit)
    SendInput("Sincerely,{enter}John Smith")
    Send("`n")
    Send("Another line.`n")
    Send("{Raw}``100`%`n")
    Send("{Blind}{Text}You should see '{Blind}{Text}' after the ellipses ... {Blind}{Text}`n")
    Send("{Blind}You should not see anything after the ellipses ... '{Blind}'`n")
    Send("{Text}You should see the Blind mode syntax after the ellipses ... '{Blind}'")
}

Keysharp with unexpected output (see comments in code):

Run("Notepad.exe")
WinWaitActive("ahk_exe notepad.exe")

MyGui := Gui(, "Send tests")
MyEdit := MyGui.Add("Edit", "w400 h400")
MyBtn1 := MyGui.Add("Button", "x10", "Notepad")
MyBtn2 := MyGui.Add("Button", "x95 yp", "This Edit")

MyBtn1.OnEvent("Click", "SendSimple")
MyBtn2.OnEvent("Click", "SendToGui")


MyGui.Show()

SendSimple() {
    WinActivate("ahk_exe Notepad.exe")
    SendInput("Sincerely,{enter}John Smith")
    Send("`n")
    Send("Another line.`n")
    Send("{Raw}``100`%`n")
    Send("{Blind}{Text}You should see '{Blind}{Text}' after the ellipses ... {Blind}{Text}`n")
    ; Line above produces [You should see '' after the ellipses ...] 
    Send("{Blind}You should not see anything after the ellipses ... '{Blind}'`n")
    Send("{Text}You should see the Blind mode syntax after the ellipses ... '{Blind}'")
}

SendToGui() {
    WinActivate(MyGui)
    ControlFocus(MyEdit)
    SendInput("Sincerely,{enter}John Smith")
    Send("`n")
    Send("Another line.`n")
    Send("{Raw}``100`%`n")
    Send("{Blind}{Text}You should see '{Blind}{Text}' after the ellipses ... {Blind}{Text}`n")
    ; Line above produces [You should see '' after the ellipses ...] 
    Send("{Blind}You should not see anything after the ellipses ... '{Blind}'`n")
    Send("{Text}You should see the Blind mode syntax after the ellipses ... '{Blind}'")
}

Offending line in the Keysharp code produces

You should see '' after the ellipses ... 

but should produce

You should see '{Blind}{Text}' after the ellipses ... {Blind}{Text}

Comments (4)

  1. Log in to comment