added OnOffToggle parameter
https://github.com/8LWXpg/RegExHotstring/releases/tag/v4.1
RegExHotstring - dynamic RegEx Hotstrings
Re: RegExHotstring - dynamic RegEx Hotstrings
If it can support '# IfWin' and '# HotIf', it will be more powerful and practical. Eagerly anticipating。
Re: RegExHotstring() dynamic RegEx Hotstrings
Hello,
I can't trigger the RegEX if it containts more than one word.
for exemple I want to tringer it when ever I type @Robot commande param1 param2 , it shoud execute the commande function with param1, param2
@8LWXpg , can you help make it work?
Thank your for your support.
I can't trigger the RegEX if it containts more than one word.
for exemple I want to tringer it when ever I type @Robot commande param1 param2 , it shoud execute the commande function with param1, param2
Code: Select all
RegExHotstring("@Robot\s(commande)\s(param1)\s(param2) /t}", commande , "C*") ; the trigger can be space or tabulation.
Thank your for your support.
8LWXpg wrote: ↑23 Feb 2023, 08:35current work around is to make two separate hotstrings, one take "[.,;:]" at the end and use "*" option, another doesn't.frabjous wrote: ↑20 Feb 2023, 16:25This script is excellent but I am having trouble creating a dynamic hotstring which is triggered by either a space or a punctuation mark at the end of the entered text. I thought I could do this with the recently added "no end key" option and including the punctuation marks in the hotstring (along the lines "[.,;: ]") but then I cannot make it work when a space is typed. Am I missing something?
Re: RegExHotstring() dynamic RegEx Hotstrings
as said in the readme, it's unable to match white space characters.fmoon wrote: ↑09 Feb 2024, 12:28Hello,
I can't trigger the RegEX if it containts more than one word.
for exemple I want to tringer it when ever I type @Robot commande param1 param2 , it shoud execute the commande function with param1, param2
@8LWXpg , can you help make it work?Code: Select all
RegExHotstring("@Robot\s(commande)\s(param1)\s(param2) /t}", commande , "C*") ; the trigger can be space or tabulation.
Thank your for your support.
-
- Posts: 13
- Joined: 09 Jan 2019, 16:52
Re: RegExHotstring - dynamic RegEx Hotstrings
is there an option to cancel the replacement on a condition in the callback?
for example
for example
Code: Select all
rand(match) {
if (match[0] != 'aaa') {
; cancel and don't replace and return
}
static char := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
static char_len := StrLen(char)
loop match[1] {
r := Random(1, char_len)
str .= SubStr(char, r, 1)
}
SendText(str)
}
Re: RegExHotstring - dynamic RegEx Hotstrings
You have two ways:AladdinMhemed wrote: ↑25 Feb 2024, 00:48is there an option to cancel the replacement on a condition in the callback?
- Catch the trigger string and send it back.
- Use the B0 option to suppress the trigger string remove, then send backspace characters equal to the length of the trigger string, followed by the replace string.
Re: RegExHotstring - dynamic RegEx Hotstrings
Alright, Ladies and Gents: how's everyone using this? Great function, by the way!
Re: RegExHotstring - dynamic RegEx Hotstrings
Remove SendLevel in script, now users need to decide where to change SendLevel.
https://github.com/8LWXpg/RegExHotstring/releases/tag/v5.0
And new doc added
https://github.com/8LWXpg/RegExHotstring?tab=readme-ov-file#how-to-trigger-regular-hotstring-in-the-same-script
https://github.com/8LWXpg/RegExHotstring/releases/tag/v5.0
And new doc added
https://github.com/8LWXpg/RegExHotstring?tab=readme-ov-file#how-to-trigger-regular-hotstring-in-the-same-script
Re: RegExHotstring - dynamic RegEx Hotstrings
@8LWXpg
Generally nice script, but it breaks all applications that rely on pressing and holding any of the a-z keys (especially games, i.e. Minecraft).
With an active script that uses RegExHotstring command, try using WASD to move in this online Minecraft schematic viewer cubical.xyz. Then exit that script and try moving again - you'll see that movement works as expected.
My question: is it possible to somehow not break the press and hold functionality?
Generally nice script, but it breaks all applications that rely on pressing and holding any of the a-z keys (especially games, i.e. Minecraft).
With an active script that uses RegExHotstring command, try using WASD to move in this online Minecraft schematic viewer cubical.xyz. Then exit that script and try moving again - you'll see that movement works as expected.
My question: is it possible to somehow not break the press and hold functionality?
Re: RegExHotstring - dynamic RegEx Hotstrings
Thanks for fast reply, but after updating and running a simple script that includes RegExHotstring and normal Hotstrings an error occurs.
Error:
Script:
Run the script and then press anything and you'll get this error. I have AutoHotkey v2.0.15 installed.
Error:
Script:
Code: Select all
#Requires AutoHotkey >=2.0-
#SingleInstance Force
#Include "RegExHotstring.ahk"
^+Ins::ExitApp
::abc::cba
RegHook.MinSendLevel := 2
SendLevel(1)
RegExHotstring("([A-Z])([A-Z])([a-z]+)", "$1$L2$3", "TC")
Re: RegExHotstring - dynamic RegEx Hotstrings
Fixed SendLevel in function OnKeyUp
Fixed bug in option * with B0
https://github.com/8LWXpg/RegExHotstring/releases/tag/v5.2
Fixed bug in option * with B0
https://github.com/8LWXpg/RegExHotstring/releases/tag/v5.2
Re: RegExHotstring - dynamic RegEx Hotstrings
Again thanks for a fast reply. I came to report further errors. So in Minecraft (and many other games) a very common thing to do is to press any of the WSAD move keys and while pressing them press Space to jump. Unfortunately if you do this while the script is running you get stuck walking in the direction you were walking even if you release all WSAD keys and Space. You can test it yourself on the cubical site.
Re: RegExHotstring - dynamic RegEx Hotstrings
The current implementation has a problem with properly catching and sending the 'key up' event, which I have not found a good workaround yet.
https://github.com/8LWXpg/RegExHotstring/issues/9
I've created a branch that does not suppress text keys. This may be slightly jankier if the cursor moves within the Callback, but it reduces the need for workarounds.
https://github.com/8LWXpg/RegExHotstring/tree/no_suppress_text
https://github.com/8LWXpg/RegExHotstring/issues/9
I've created a branch that does not suppress text keys. This may be slightly jankier if the cursor moves within the Callback, but it reduces the need for workarounds.
https://github.com/8LWXpg/RegExHotstring/tree/no_suppress_text
Re: RegExHotstring - dynamic RegEx Hotstrings
Yeah, I thought that my last post was too much for such script. Nevertheless - this is very good script. You still managed to get it working for simple gameplay usage where you don't have to jump while walking and make it work with other normal hotstrings in the same file. Much thanks for that. But I'll have to disable this script for games. I know that current limitation is that it is "incompatible with #IfWin or #HotIf". But is there a hard way solution? Like setting up a listener that would run every time the active window changes and (un)registers RegExHotstrings for certain windows?
I know that this would require me to make a list of all games' WinTitles and check this list on every window change but I'm willing to do this.
I know that this would require me to make a list of all games' WinTitles and check this list on every window change but I'm willing to do this.
Re: RegExHotstring - dynamic RegEx Hotstrings
As I said before,
And for the bug, the script in the branch should fix the bug, just slightly jankier if the cursor moves within the Callback (like Send("{Left 3}")).
However, if you manage to invoke a function at every window focus change, you can disable the InputHook used by RegExHotString, this would stop all the RegExHotString.
Code: Select all
RegHook.Stop()
Re: RegExHotstring — dynamic RegEx Hotstrings
I did. It was surprisingly easy. All I had to do was to add this at the end of the script, that I've posted previously:8LWXpg wrote: However, if you manage to invoke a function at every window focus change
Code: Select all
GroupAdd "Games", "Minecraft ahk_exe javaw.exe"
; ... more games to be added here
Loop {
If (WinActive("ahk_group Games")) {
RegHook.Stop()
} else {
RegHook.Start()
}
WinWaitNotActive WinExist("A") ; This does the trick
}
Code: Select all
#Requires AutoHotkey >=2.0-
#SingleInstance Force
#Include "RegExHotstring.ahk"
^+Ins::ExitApp
::youre::you're
RegHook.MinSendLevel := 2
SendLevel(1)
RegExHotstring("([A-Z])([A-Z])([a-z]+)", "$1$L2$3", "TC")
GroupAdd "Games", "Minecraft ahk_exe javaw.exe"
; ... more games/programs to be added here
Loop {
If (WinActive("ahk_group Games")) {
RegHook.Stop()
} else {
RegHook.Start()
}
WinWaitNotActive WinExist("A")
}
Re: RegExHotstring - dynamic RegEx Hotstrings
Fixed KeyUp sending with another workaround
https://github.com/8LWXpg/RegExHotstring/releases/tag/v5.3
https://github.com/8LWXpg/RegExHotstring/releases/tag/v5.3
Re: RegExHotstring - dynamic RegEx Hotstrings
OK, I've tested this new version and I can gladly say it works in Minecraft (and some other games). Great job!
Return to “Scripts and Functions (v2)”
Who is online
Users browsing this forum: Spikea and 17 guests