Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Auto-execute section
- ; Note: no commands / variable names / etc. are case sensitive.
- ; How to escape characters:
- ; `% (perc. sign)
- ; "" (double quotes)
- ; Commas should not be used in the list of matching pairs, and spaces only to separate the members of each pair. Both restrictions can be changed if needed.
- AllMatchingPairs :=
- (LTrim Join`, ; This section may not exceed 16,383 characters.
- "
- '6 {U+2018}
- '9 {U+2019}
- ""6 {U+201c}
- "
- )
- AllNgraphs := RegExReplace(AllMatchingPairs, "(\s[^,]*)|(^,)|(,$)") ; Creates string of n-graphs to match.
- ; End of auto-execute section
- ; ----------------------------------------------------------
- ^k::
- Input, NgraphTyped, V, {Escape}, %AllNgraphs% ; Escape cancels input. If V(isible) is removed, the two {Backspace ...} below should also be removed.
- If ( Errorlevel = "Match" )
- Loop, Parse, AllMatchingPairs, `,
- {
- Loop, Parse, A_Loopfield, %A_Space%
- {
- If (A_Index = "1")
- {
- If ( A_Loopfield != NgraphTyped )
- Break
- Else
- StringLen, NgraphLength, A_Loopfield
- }
- If (A_Index = "2")
- {
- If ( NgraphLength > 10 )
- {
- NgraphLength := 10
- Send {Backspace %NgraphLength%}%A_Loopfield%
- Msgbox Error: sending more than 10 backspaces is probably a bug.
- }
- Else
- Send {Backspace %NgraphLength%}%A_Loopfield%
- Return
- }
- }
- }
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement