Intermittent Hotstring Error - First Letter of Hotstring Not replaced Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
pptx
Posts: 4
Joined: 21 Sep 2017, 11:48

Intermittent Hotstring Error - First Letter of Hotstring Not replaced

21 Sep 2017, 12:20

I occasionally run into an issue with hotstrings whereby the first letter is not replaced. Here is an example of a hotstring that occasionally has this issue.

:O*:ytt!:: ;;Youtube Search Hotstring
{
tempstore=%clipboard%
sleep 100
clipboard:="https://www.youtube.com/results?search_query="
send ^v
sleep 100
clipboard=%tempstore%
}
return

99% of the time, the above will replace "ytt!" with "https://www.youtube.com/results?search_query=". However, sometimes the output is "yhttps://www.youtube.com/results?search_query=".

I mainly use hotstrings in my browser and have only noticed this issue there. I have seen the issue in both firefox and chrome. It seems to happen when I have a lot of tabs open.

Additional information:
- Let's say I have a chrome window open with 200 tabs and I notice this hotstring replacement issue. If I open a second chrome window with one tab the hotstring will work fine there, but the issue will persist in the original window with 200 tabs.

Yes, I know that the solution is to have better control of the tabs that I have open. But does anyone understand why this issue happens in the first place? Any help is greatly appreciated as this has been bugging me for quite some time.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Intermittent Hotstring Error - First Letter of Hotstring Not replaced

21 Sep 2017, 13:47

The browser might do highlighted suggestions as you type, hence, one backspace is deleting the highlighted suggestion instead of the trigger string. Cheers.
pptx
Posts: 4
Joined: 21 Sep 2017, 11:48

Re: Intermittent Hotstring Error - First Letter of Hotstring Not replaced

21 Sep 2017, 14:14

Thanks for the reply. Interesting theory about the highlighted suggestion in the browser url. I changed "ytt!" to "you!" in the hotstring above to see if highlighted suggestions have any effect and it appears they do not. As I start to type "you!" in the browser url, highlighted suggestions appear for youtube.com, but in the end the hotstring functions successfully and all characters outside of the highlighting are also replaced.

I suppose adding a backspace to the hotstring as shown below would solve this issue, but I'm still curious as to why this behavior occurs in the first place. Any ideas? Has anyone else experienced this behavior?
:O*:ytt!:: ;;Youtube Search Hotstring
{
tempstore=%clipboard%
sleep 100
clipboard:="https://www.youtube.com/results?search_query="
send {Backspace}
send ^v
sleep 100
clipboard=%tempstore%
}
return
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
Contact:

Re: Intermittent Hotstring Error - First Letter of Hotstring Not replaced  Topic is solved

21 Sep 2017, 14:29

try

Code: Select all

{
	tempstore=%clipboard%
	sleep 100
	clipboard:="https://www.youtube.com/results?search_query="
	send ^a
	send ^v
	sleep 100
	clipboard=%tempstore%
}
depending on your browser you can also just add a search keyword to it, e.g. in firefox you can right click a search box and click add keyword for this search.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
[/color]
pptx
Posts: 4
Joined: 21 Sep 2017, 11:48

Re: Intermittent Hotstring Error - First Letter of Hotstring Not replaced

21 Sep 2017, 15:12

Thanks for the suggestion KuroiLight. That will work just fine. I am still curious as to why this behavior occurs in the first place - any ideas?
Helgef, I replied to your comment, but the reply hasn't been approved yet as I'm a new member. In case the reply has somehow gotten lost, I did a little test to see if highlighted suggestions would affect the hotstring replacement behavior and it didn't seem to have any effect. I changed "ytt!" to "you!", as this reliably brings up the highlighted suggestion of youtube.com. In the end everything was replaced, included the non-highlighted characters. Thanks for the suggestion.
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
Contact:

Re: Intermittent Hotstring Error - First Letter of Hotstring Not replaced

21 Sep 2017, 15:16

Its likely because your browser is slowing down, trying to autocomplete or something and not highlighting the text properly.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
[/color]
pptx
Posts: 4
Joined: 21 Sep 2017, 11:48

Re: Intermittent Hotstring Error - First Letter of Hotstring Not replaced

21 Sep 2017, 16:40

Yes, definitely agree that it likely has to do with the browser consuming a lot of resources. Was hoping there might be some setting (in either chrome or ahk) to prevent this. Anyway, your suggestion works fine and if I don't receive better suggestions within a few days, I'll mark your answer as accepted. Thanks, again.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 366 guests