| View previous topic :: View next topic |
| Author |
Message |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Fri Dec 21, 2007 10:46 pm Post subject: |
|
|
Thanks for the ideas and solutions, I forgot about this script. Anyway I've completely rewrote it and uploaded the new version. _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1163 Location: Denmark
|
Posted: Sat Dec 22, 2007 11:21 am Post subject: |
|
|
Nice!
One suggestion and a couple of issues, though.
When replacing the hotstring this seems to work smoother:
| Code: | ...
If (IsLabel(ct2)) {
SendInput, {BS %rl%}
Gosub, %ct2%
}
Else {
Transform, ctr, Deref, %ct2%
SendInput, {BS %rl%}%ctr%
}
... |
Trying the rjwilmsi example I found that anna is correctly, automagically changed to Anna, but nanna is wrongly changed to nAnna.
Try hotstrings("ann(a|e)" , "Ann%$1%") and type nAnne - try to correct the A to a ({left 4}{bs}a)! _________________ there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face
- Kashmir |
|
| Back to top |
|
 |
rjwilmsi
Joined: 18 May 2005 Posts: 13
|
Posted: Sat Dec 22, 2007 12:12 pm Post subject: |
|
|
| tonne wrote: | | Trying the rjwilmsi example I found that anna is correctly, automagically changed to Anna, but nanna is wrongly changed to nAnna. |
I'm not sure if that's a bug as such as I would want text within words to be corrected, e.g. correcting 'sss' to 'ss'. Perhaps my Anna example was a bad one to choose, or could we introduce a third argument to specify whole word/within word correction? |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Sat Dec 22, 2007 12:29 pm Post subject: |
|
|
Have you tried hotstrings("\bann(a|e)" , "Ann%$1%") _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
rjwilmsi
Joined: 18 May 2005 Posts: 13
|
Posted: Sat Dec 22, 2007 1:33 pm Post subject: |
|
|
Thanks for the very helpful posts guys (and girls?). I'll take a proper look at version 2 of the script and the suggestions in this topic when I'm back on Windows at work in the new year. I'll then post back with further examples to help others using the script. Probably this script should then be promoted to the sample list in the AHK help.
In the meantime, happy holidays to all! |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1163 Location: Denmark
|
Posted: Sat Dec 22, 2007 2:21 pm Post subject: |
|
|
| Titan wrote: | | Have you tried hotstrings("\bann(a|e)" , "Ann%$1%") |
Nope, I tried \s; \b works! I better read up on regexps ;-} _________________ there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face
- Kashmir |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Sat Dec 22, 2007 2:30 pm Post subject: |
|
|
Glad it does
I've included an example with \b in scripts comments for anybody who hasn't read these posts. _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
scoob8000
Joined: 18 Dec 2007 Posts: 9
|
Posted: Fri Dec 28, 2007 8:08 pm Post subject: |
|
|
I've been trying to get this function to work for me for a few days with no luck. Just for the heck of it, I tried it on my other PC and it works just fine.
Both pc's have the same version of AHK, and my ahk files are identical.
Only real difference is one is windows 2000, and the other is XP.
Can anyone shed some light on the matter?  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Fri Dec 28, 2007 8:21 pm Post subject: |
|
|
Can't see why that is, this script only uses core functionality of AutoHotkey. Have you tried #InstallKeybdHook? _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
scoob8000
Joined: 18 Dec 2007 Posts: 9
|
Posted: Mon Dec 31, 2007 2:00 pm Post subject: |
|
|
I just tried #InstallKeybdHook, still no luck.
Going to do some more digging, there's gotta be something running on this machine preventing it from working..
Should it matter if AHK is installed or just unzipped into it's own folder in program files? |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Mon Dec 31, 2007 2:04 pm Post subject: |
|
|
| scoob8000 wrote: | | Should it matter if AHK is installed or just unzipped into it's own folder in program files? | I highly doubt it.
Can anyone else with <XP use this script? _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
scoob8000
Joined: 18 Dec 2007 Posts: 9
|
Posted: Wed Jan 02, 2008 2:05 pm Post subject: |
|
|
| Titan wrote: |
Can anyone else with <XP use this script? |
I couldn't find anything running on my W2K workstation, so I'll give it a shot in a vmware box at home if I remember.
Nonetheless, I'm just going to work with this on my XP machine for now..
I've pretty much got things figured out.
After my hotstring matches I want to send a {tab} without replacing the text the hotstring matched.
I'm drawing a blank here, I've tried using a seperate label but that still replaces the text with the tab.
#Hotstring b0 doesn't seem to do the trick either.
-Mike |
|
| Back to top |
|
 |
rjwilmsi
Joined: 18 May 2005 Posts: 13
|
Posted: Sun Jan 06, 2008 11:15 pm Post subject: |
|
|
Two comments on version 2 of the script:
First of all let me say that version 2 of the script is an improvement on the first version, as the second version resolved a couple of issues I had.
However, I've found a couple of further/unresolved issues with version 2 of the script, so would like to post them for help / discussion:
| Code: | | hotstrings("([hwHW]a|i)(s?sn|ns)(['s])?t(\s)" , "%$1%sn't%$4%") |
In this example isnt is replaced by isn't (etcetera) after a further space is pressed. However, typing isnt followed by a tab produces iisn't. Bug?
| Code: | | hotstrings("(B|b)tw\s", "%$1%y the way") |
In this example typing btw followed by two spaces produces by the ww. Bug?
Performance of the script seems better if this line uses SendInput rather than Send. Is that okay?
I will post a selection of examples once these issues are resolved/I understand I've gone wrong. Thanks. |
|
| Back to top |
|
 |
|