Hotstring Bug? Topic is solved

Report problems with documented functionality
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Hotstring Bug?

30 Nov 2018, 09:12

Not work in AHK v1.1.30.01 64-bit/Unicode but work fine in v1.1.30.00 64-bit/Unicode

Code: Select all

#NoEnv
#SingleInstance force
SetTitleMatchMode 2
SetKeyDelay, -1
#Persistent

#If isExplorerActive() 
Hotstring(":*X:" "T1" , "MisHostrings" ) 
#If

Return

MisHostrings() {
  MsgBox 0x40000, % A_ThisFunc, % "Què!! " A_ThisHotkey
}

IsExplorerActive() {
ControlGetFocus, focusedControl, A
Return (WinActive("ahk_class CabinetWClass")&&(focusedControl=="Edit1"))
}
Last edited by jmeneses on 02 Dec 2018, 04:37, edited 2 times in total.
Donec Perficiam
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

Re: What am I doing wrong?

01 Dec 2018, 12:12

Works fine on my v1.1.30.01 64-bit/Unicode, Win7Ultimate X64.
live ? long & prosper : regards
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: What am I doing wrong?

01 Dec 2018, 13:27

CyL0N wrote:
01 Dec 2018, 12:12
Works fine on my v1.1.30.01 64-bit/Unicode, Win7Ultimate X64.
really? I don't understand, you get the msgbox? :crazy:
Donec Perficiam
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

Re: What am I doing wrong?

01 Dec 2018, 18:23

:facepalm: Apologies that was late night clumsiness,i glazed over the MsgBox, i saw a literal replacement & i guess thought that was meant to be the case.

This must be the cause though: Recent Changes To 1.1.30.01...
  • 1.1.30.01 - November 11, 2018
    • Fixed escape sequences in one-line hotstrings with 'X' option.
I tried a number of variations,but i don't know how the change is supposed to work,if at all it didn't break the X option,because it looks like it did,'X' is just being ignored.

Possibly Rename this thread to 1.1.30.01 - Hotstring Bug?.
live ? long & prosper : regards
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: Hotstring Bug?

02 Dec 2018, 04:36

Thank you
I'll take care of you
Donec Perficiam
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: Hotstring Bug?

06 Dec 2018, 13:56

Someone has obtained the msgbox with the latest version of AHK?
Donec Perficiam
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: Hotstring Bug?

06 Dec 2018, 14:21

Looks buggy.

Out of this:

Code: Select all

:X:T1::MisHostrings()
Hotstring(":X:T2", MisHostrings)
Hotstring(":X:T3", MisHostrings())
Hotstring(":X:T4", "MisHostrings")
Hotstring(":X:T5", "MisHostrings()")
Only T1 shows the MsgBox.
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Hotstring Bug?

06 Dec 2018, 14:27

safetycar wrote:
06 Dec 2018, 14:21
Looks buggy.

Out of this:

Code: Select all

:X:T1::MisHostrings()
Hotstring(":X:T2", MisHostrings)
Hotstring(":X:T3", MisHostrings())
Hotstring(":X:T4", "MisHostrings")
Hotstring(":X:T5", "MisHostrings()")
Only T1 shows the MsgBox.
I agree. I can't get the "X" option to work when creating a hotstring with the Hotstring function.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: Hotstring Bug?

07 Dec 2018, 11:07

It's a bug
Donec Perficiam
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Hotstring Bug?

07 Dec 2018, 13:12

safetycar wrote:
06 Dec 2018, 14:21
Looks buggy.

Out of this:

Code: Select all

:X:T1::MisHostrings()
Hotstring(":X:T2", MisHostrings)
Hotstring(":X:T3", MisHostrings())
Hotstring(":X:T4", "MisHostrings")
Hotstring(":X:T5", "MisHostrings()")
Only T1 shows the MsgBox.
See auto execute .
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Hotstring Bug?

07 Dec 2018, 14:02

Helgef wrote:
07 Dec 2018, 13:12
safetycar wrote:
06 Dec 2018, 14:21
Looks buggy.

Out of this:

Code: Select all

:X:T1::MisHostrings()
Hotstring(":X:T2", MisHostrings)
Hotstring(":X:T3", MisHostrings())
Hotstring(":X:T4", "MisHostrings")
Hotstring(":X:T5", "MisHostrings()")
Only T1 shows the MsgBox.
See auto execute .
I don't believe that was meant as a literal working example. T2, T3, T5 will not even run as they throw a syntax error.

The point being that the Hotstring function appears to now be expecting a Function Reference like produced by Func to work at all and running a subroutine by label appears to not be an option.

This works: Hotstring(":*X:" "T1" , Func("MisHostrings") ).

It is fine to work like this but it needs to be documented that is how it works now and it is somewhat incomplete.

This is how it works in v2 and probably the way it should work in v1.

Code: Select all

Hotstring(":*X:" "T1" , "HS1")  ;  function because only function exist
Hotstring(":*X:" "T2" , Func("HS2"))  ; function because function reference
Hotstring(":*X:" "T3" ,"HS3") ; label because only label exist
Hotstring(":*X:" "T4" ,"HS4") ; label because function and label exist but defaults to label
Hotstring(":*X:" "T5" , Func("HS4")) ; function because function reference

Esc::ExitApp

HS1() 
{
  MsgBox("Function: " A_ThisFunc)
}

HS2() 
{
  MsgBox("Function: " A_ThisFunc)
}

HS4() 
{
  MsgBox("Function: " A_ThisFunc)
}

HS3:
  MsgBox("Label: " A_ThisLabel)
return

HS4:
  MsgBox("Label: " A_ThisLabel)
return
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Hotstring Bug?

18 Dec 2018, 18:17

so whats the consensus on this?
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Hotstring Bug?

31 Dec 2018, 13:29

I found the bug mentioned earlier after upgrading from 1.1.28.00 to v1.1.30.01. But is was intermittent. If found that the X command is ignored at the first load of the Hotstring but is executed after the Hotstring is turned OFF and ON again.

Code: Select all

#SingleInstance force

strHotstring := ":X*:#go#"
firstTime := true

MsgBox, Press Alt + L to load the hostring`n`n(requires v1.1.30.01 to show the bug)

!l:: ; load
Hotstring(strHotstring, "Go", "On") ; this type "Go" instead of executing the label "Go:"
if (firstTime)
	MsgBox, Hotstring "%strHotstring%" turned ON.`n`nTry it: type "#go#". Instead of eXecuting the hotstring, it will type "Go" (as would do a non "X" hotstring).`n`nThen, press Alt + R to reload the hostring (turn OFF and ON again).
else
	MsgBox, Hotstring "%strHotstring%" turned ON again.`n`nTry it again: type "#go#". Now, it will work.
return

!r:: ; reload
Hotstring(strHotstring, "Go", "Off") ; this type "Go" instead of executing the label "Go:"
MsgBox, Hotstring "%strHotstring%" turned OFF
firstTime := false
gosub, !l
return

Go:
MsgBox, The hotstring "%A_ThisHotkey%" was eXecuted!
return
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Hotstring Bug?

31 Dec 2018, 13:48

JnLlnd wrote:
31 Dec 2018, 13:29
I found the bug mentioned earlier after upgrading from 1.1.28.00 to v1.1.30.01. But is was intermittent. If found that the X command is ignored at the first load of the Hotstring but is executed after the Hotstring is turned OFF and ON again.

Code: Select all

#SingleInstance force

strHotstring := ":X*:#go#"
firstTime := true

MsgBox, Press Alt + L to load the hostring`n`n(requires v1.1.30.01 to show the bug)

!l:: ; load
Hotstring(strHotstring, "Go", "On") ; this type "Go" instead of executing the label "Go:"
if (firstTime)
	MsgBox, Hotstring "%strHotstring%" turned ON.`n`nTry it: type "#go#". Instead of eXecuting the hotstring, it will type "Go" (as would do a non "X" hotstring).`n`nThen, press Alt + R to reload the hostring (turn OFF and ON again).
else
	MsgBox, Hotstring "%strHotstring%" turned ON again.`n`nTry it again: type "#go#". Now, it will work.
return

!r:: ; reload
Hotstring(strHotstring, "Go", "Off") ; this type "Go" instead of executing the label "Go:"
MsgBox, Hotstring "%strHotstring%" turned OFF
firstTime := false
gosub, !l
return

Go:
MsgBox, The hotstring "%A_ThisHotkey%" was eXecuted!
return
Interesting.

This does at least provide a work around as shown below.

Code: Select all

Hotstring(":*X:" "T1" , "HS1")  ;  function because only function exist
Hotstring(":*X:" "T1" , "HS1", "On")  ; WORKAROUND function because only function exist

Hotstring(":*X:" "T2" , Func("HS2"))  ; function because function reference

Hotstring(":*X:" "T3" ,"HS3") ; label because only label exist
Hotstring(":*X:" "T3" ,"HS3", "On") ; WORKAROUND label because only label exist

Hotstring(":*X:" "T4" ,"HS4") ; label because function and label exist but defaults to label
Hotstring(":*X:" "T4" ,"HS4", "On") ; WORKAROUND label because function and label exist but defaults to label

Hotstring(":*X:" "T5" , Func("HS4")) ; function because function reference

Esc::ExitApp

HS1() 
{
  MsgBox % "Function: " A_ThisFunc
}

HS2() 
{
  MsgBox % "Function: " A_ThisFunc
}

HS4() 
{
  MsgBox % "Function: " A_ThisFunc
}

HS3:
  MsgBox % "Label: " A_ThisLabel
return

HS4:
  MsgBox % "Label: " A_ThisLabel
return
For string function and label references to work you just need to do an On command for the hotstring. You don't have to turn it Off in order for this to work.

With the workaround all the Hotstrings work as expected in the example above.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Hotstring Bug?

31 Dec 2018, 14:59

FanaticGuru wrote:
31 Dec 2018, 13:48
For string function and label references to work you just need to do an On command for the hotstring. You don't have to turn it Off in order for this to work.

With the workaround all the Hotstrings work as expected in the example above.
In my example, it is a label (Go:) and it would not work until, after the hotstring is created, it is turned OFF and turned ON again.
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Hotstring Bug?

31 Dec 2018, 18:32

JnLlnd wrote:
31 Dec 2018, 14:59
FanaticGuru wrote:
31 Dec 2018, 13:48
For string function and label references to work you just need to do an On command for the hotstring. You don't have to turn it Off in order for this to work.

With the workaround all the Hotstrings work as expected in the example above.
In my example, it is a label (Go:) and it would not work until, after the hotstring is created, it is turned OFF and turned ON again.
No need to turn it Off, just create and then turn On in two separate commands:

Code: Select all

strHotstring := ":X*:#go#"
Hotstring(strHotstring, "Go") ; first to create
Hotstring(strHotstring, "Go", "On") ; then again with On to fix bug
return

Go:
  MsgBox, The hotstring "%A_ThisHotkey%" was eXecuted!
return
You could do it this way:

Code: Select all

Hotstring(strHotstring, "Go", "On") ; first to create
Hotstring(strHotstring, "Go", "On") ; then again to fix bug
The point being that you have to use "On" with a pre-existing Hotstring. Turning it Off is irrelevant. It is the "On" with an existing hotstring that makes it work. You can turn a Hotstring On that is already On.

Not to get side tracked though, this is definitely buggy. And this is only a in an emergency do-it-twice workaround but if you really need it then it should work and not break the script once the bug is fixed.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Hotstring Bug?

31 Dec 2018, 19:33

FanaticGuru wrote:
31 Dec 2018, 18:32
The point being that you have to use "On" with a pre-existing Hotstring. Turning it Off is irrelevant. It is the "On" with an existing hotstring that makes it work. You can turn a Hotstring On that is already On.

Not to get side tracked though, this is definitely buggy. And this is only a in an emergency do-it-twice workaround but if you really need it then it should work and not break the script once the bug is fixed.
Thanks FG, I got you. And, as you said, this should be fixed anyway (thanks to Lexikos).
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: Hotstring Bug?

01 Jan 2019, 06:55

Thaks everybody and appy good year forever friends
Donec Perficiam
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: Hotstring Bug?  Topic is solved

21 Apr 2019, 17:46

This was fixed in v1.1.30.02 (thanks to Helgef).

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 21 guests