Coder Social home page Coder Social logo

hotstring's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hotstring's Issues

A few bugs

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..."
}

Mode 3 in examples

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

How to use the lib since it got rewritten in April?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.