At the end of this post is the script that I am using. Note that I have the spaces section commented out because I find it interferes with my trigger key (double spacebar) for ActiveWords, another program I use frequently, and the semicolon section also commented out, as it is my "marker key" in Instant Text. That has nothing to do with my question, though, at least I don't think so. Perhaps it could and I'm so new to AHK that I don't realize it!
It's the colon section I'm here about. It has a glitch that I cannot figure out how to cure. It seems to always work, every single time, if I type 10:00 or anything and then :00. Yet sometimes (not always), typing 10:30 will erase the colon and the last number and wind up as "103". It isn't only the 3 key, but the 2, 4, 5, etc. Typing decimal numbers with the period never causes this. It is only with the colon. And to be clear, it isn't with just 10:30. Could be 3:45 or any other combo. Just
never with :00!
Here is what I have tried so far. Instead of BS, I tried using this:
Code:
;Colon autospacing
$+;::
; IfEqual Colon,0, {
; IfEqual key,Space, Send {Left 1}{Del}
; Send +;{SPACE}{LEFT}{RIGHT}{SPACE}
; }
IfEqual Colon,0, Send +;{SPACE}{LEFT}{RIGHT}{SPACE}
Else IfEqual Colon,1, Send {Left 2}{Del 2}
Else Send +;
Colon++
Return
Exact same problem occurred.
I tried this:
Code:
$+;::
IfEqual Colon,0, {
IfEqual key,Space, Send {Left 2}
Send +;{SPACE}{LEFT}{RIGHT}{SPACE}
}
Else IfEqual Colon,1, Send {Left 2}
Else Send +;
Colon++
Return
No luck there, either.
I tried sticking this in:
if GetKeyState("Shift") ; Shift key is up
Thought that was a possibility, but it did not help.
And lastly, I tried sticking in a setkeydelay, and I tried each from 0 through 10, none of them changed anything. However, I'm not certain I put it in the right place. I put it immediately below the beginning, as in:
$+;::
SetKeyDelay, 10
I'm uncertain what else to try. It's been suggested I look into Threads. Would that be the right track to pursue? I am incredibly happy with this script as it is. I can't tell you how wonderful it is for me! I have a very few other things I want to tweak on it for my own particular needs and I think I can, but I do not believe I'm going to figure out the fix for the colon issue. Can anyone help?
Thank you!
(As stated, the script I am currently using stands as below)
Code:
;ITspacingscript.ahk
Comma = 0
Semic = 0
Colon = 0
Period = 0
Questn = 0
Exclam = 0
SQuote = 0
Loop
{
Input key,I L1 M V,{TAB}{Esc}{BS}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}
Comma = 0
Semic = 0
Colon = 0
Period = 0
Questn = 0
Exclam = 0
SQuote = 0
}
Return
$,::
IfEqual Comma,0, {
IfEqual key,Space, Send {BS 1}
Send ,,{Space 1}
}
Else IfEqual Comma,1, Send {BS 1}
Else Send ,,
Comma++
Return
;$;::
IfEqual Semic,0, {
IfEqual key,Space, Send {BS 1}
Send `;{Space 1}
}
Else IfEqual Semic,1, Send {BS 1}
Else Send `;
Semic++
Return
$+;::
IfEqual Colon,0, {
IfEqual key,Space, Send {BS 2}
Send +;{Space 2}
}
Else IfEqual Colon,1, Send {BS 2}
Else Send +;
Colon++
Return
$.::
IfEqual Period,0, {
IfEqual key,Space, Send {BS 2}
Send .{Space 2}
}
Else IfEqual Period,1, Send {BS 2}
Else Send .
Period++
Return
$+/::
IfEqual Questn,0, {
IfEqual key,Space, Send {BS 2}
Send +/{Space 2}
}
Else IfEqual Questn,1, Send {BS 2}
Else Send +/
Questn++
Return
$+1::
IfEqual Exclam,0, {
IfEqual key,Space, Send {BS 2}
Send +1{Space 2}
}
Else IfEqual Exclam,1, Send {BS 2}
Else Send +1
Exclam++
Return
$Enter::
IfEqual Comma,1, Send {BS 1}
Comma = 0
IfEqual Semic,1, Send {BS 1}
Semic = 0
IfEqual Colon,1, Send {BS 2}
Colon = 0
IfEqual Period,1, Send {BS 2}
Period = 0
IfEqual Questn,1, Send {BS 2}
Questn = 0
IfEqual Exclam,1, Send {BS 2}
Exclam = 0
Send {Enter}
Return
$Tab::
IfEqual Comma,1, Send {BS 1}
Comma = 0
IfEqual Semic,1, Send {BS 1}
Semic = 0
IfEqual Colon,1, Send {BS 2}
Colon = 0
IfEqual Period,1, Send {BS 2}
Period = 0
IfEqual Questn,1, Send {BS 2}
Questn = 0
IfEqual Exclam,1, Send {BS 2}
Exclam = 0
Send {Tab}
Return
;$Space::
IfEqual Comma,1, Send {BS 1}
Comma = 0
IfEqual Semic,1, Send {BS 1}
Semic = 0
IfEqual Colon,1, Send {BS 2}
Colon = 0
IfEqual Period,1, Send {BS 2}
Period = 0
IfEqual Questn,1, Send {BS 2}
Questn = 0
IfEqual Exclam,1, Send {BS 2}
Exclam = 0
Send {Space}
key = Space
Return
~0::
~1::
~2::
~3::
~4::
~5::
~6::
~7::
~8::
~9::
If key is integer
IfEqual Period,1
Send {Left}{BS 2}{Right}
IfEqual Colon,1
Send {Left}{BS 2}{Right}
IfEqual Comma,1
Send {Left}{BS 1}{Right}
Return
^-::
Suspend, On
Return
^=::
Suspend, Off
Return