menixator / hotstring Goto Github PK
View Code? Open in Web Editor NEWTrigger a Hotstring through dynamic means with Autohotkey
License: Other
Trigger a Hotstring through dynamic means with Autohotkey
License: Other
If you use
::фыв::привет
in plain AHK - the hotstring won't work out upon typing "asd" (those Cyrillic letters "фыв" lay on the same keyboard keys as "asd").
But with your lib - it does.
Could you, please, somehow fix that?
In the documentation, Mode: Can be either 0,1 or 2.
, but in the example, there is 3 in the Mode argument: Hotstring("(\d+)\/(\d+)%", "percent",3) ; One of poly's examples
Hey.
I earlier used it like this:
#Include Hotstring.ahk
Array := {}
Loop, Read, %A_ScriptDir%\Hotstrings.ini
{
tmp := StrSplit(A_LoopReadLine, "|")
Array.Insert(tmp[1], tmp[2])
Hotstring(tmp[1],"subroutine")
}
return
subroutine:
MsgBox % Array[$] ; it worked earlier, but now it shows blank msgbox.
Return
But since the lib's rewrite in April, (irregardless of the fact that hotstrings get correctly added and are generally working) var "$" is blank whenever the subroutine gets called.
Please, help.
For the following script, I pasted your code to the bottom and ran it. Many of the tests I created are working, but a few do not.
#NoEnv
#SingleInstance force
#Warn
; these are working
; -----------------
Hotstring("btw", "by the way") ; simple text replacement
Hotstring("ahk", "autohotkey") ; case-insensitive
Hotstring("trigger1", "replace") ; case-insensitive
Hotstring("(\d+)\/(\d+)%", "percent", 3) ; regex mode --> (2/2% -> 100) or (70/100% -> 70%)
Hotstring("i)((d|w)on)(t)", "$1'$3",3) ; DONT --> DON'T, dont --> don't, dOnt --> dOn't, WONT --> WON'T
Hotstring("toLabel", "label") ; call a label
Hotstring("i)regex_(trigger)", "replace2", 3) ; regex with capturing
Hotstring("only1", "onlyOnce") ; only works one time!
; these are NOT working
; -----------------
Hotstring("Abc", "Alphabet", 2) ; case-sensitive - (BUG: does not erase the triggering text)
Hotstring("Trigger2", "replace", 2) ; case-sensitive - (BUG: the value of $ is empty)
Hotstring("i)colou?rs","$0 $0 everywhere!", 3) ; Regex, Case insensitive - (BUG: the $0 is not replaced, it uses the exact string)
Hotstring("(B|b)i(\d+)(\r\n|\n|\r)", "hsBackInX") ; back in X minutes (does not trigger at all - but is valid regex for "bi10{cr}" or "Bi5{crlf}" or "bi20{lf}")
return
label:
; $ == "toLabel"
MsgBox % "In the 'label' code... - triggered by [" . $ . "]"
return
percent:
; now $ is a match object.
sendInput, % Round(($.Value(1)/$.Value(2))*100) . "%"
return
replace($) {
; $ == 'trigger'
MsgBox % "'" . $ . "' was entered!"
}
replace2($) {
;$ is a match Object
Msgbox % $.Value(0) . " was entered."
Msgbox % $.Value(1) . " == 'trigger'"
}
onlyOnce($) {
MsgBox % "This will only be shown once..."
Hotstring("only1", "")
}
hsBackInX($) {
; global $
; addHotString()
;sendText($.1 . "ack in " . $.2 . " minutes...")
msgBox % "Back in " . $.Value(2) . "minutes..."
}
Unfortunately, currently setting
#Hotstring, EndChars `n
does nothing.
I know I can add "`n" to the end of my hotstrings' keywords and change the hotstring() call to "regexp" type, but this is PITA.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.