-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nimcache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
# sanictype | ||
|
||
autocomplete for windows, written in nim | ||
|
||
### Usage | ||
Download it by clicking the download from zip button. Unzip it to whatever directory you want. | ||
|
||
Next, double click on sanic.exe. A window should pop up with nothing in it. You are now good to go! | ||
|
||
To use, start typing a word, and hit tab. Continue hitting tab to cycle through words based on frequency. If it glitches out, delete the word, and make sure to press space before rewriting it. The program uses spaces and newlines to keep track of new words. Backspacing can be weird. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
import os | ||
import winim | ||
import strutils | ||
var frag = "" | ||
var lastString = "" | ||
var db = newSeq[string](0) | ||
var tabs = 0 | ||
for str in readFile("db.txt").split: | ||
if len(str) > 3: | ||
db.add(str) | ||
proc complete(frag:string, i: int): string = | ||
var counter = 0 | ||
for str in db: | ||
if str.startsWith(frag): | ||
if counter == i: | ||
return str.replace(frag, "") | ||
counter += 1 | ||
proc writeString(input: string) = | ||
for c in input: | ||
keybd_event(VkKeyScan(c.BYTE).BYTE,0x9e.BYTE,0,0); | ||
keybd_event(VkKeyScan(c.BYTE).BYTE,0x9e.BYTE,KEYEVENTF_KEYUP,0); | ||
proc main() = | ||
while true: | ||
Sleep(50) | ||
for i in 8..190: | ||
if GetAsyncKeyState(cint(i)) == -32767: | ||
if VK_SPACE == i or VK_RETURN == i: | ||
frag = "" | ||
tabs = 0 | ||
lastString = "" | ||
elif VK_BACK == i: | ||
frag.delete(frag.len-2, frag.len-1) | ||
elif chr(i) in Letters: frag = frag & toLowerAscii($chr(i)) | ||
if VK_TAB == i: | ||
keybd_event(VK_BACK,0x9e.BYTE,0,0); | ||
keybd_event(VK_BACK,0x9e.BYTE,KEYEVENTF_KEYUP,0); | ||
for ch in lastString: | ||
keybd_event(VK_BACK,0x9e.BYTE,0,0); | ||
keybd_event(VK_BACK,0x9e.BYTE,KEYEVENTF_KEYUP,0); | ||
lastString = complete(frag.strip, tabs) | ||
writeString(lastString) | ||
tabs += 1 | ||
import os | ||
import winim | ||
import strutils | ||
var frag = "" | ||
var lastString = "" | ||
var db = newSeq[string](0) | ||
var tabs = 0 | ||
for str in readFile("db.txt").split: | ||
if len(str) > 3: | ||
db.add(str) | ||
proc complete(frag:string, i: int): string = | ||
var counter = 0 | ||
for str in db: | ||
if str.startsWith(frag): | ||
if counter == i: | ||
return str.replace(frag, "") | ||
counter += 1 | ||
proc writeString(input: string) = | ||
for c in input: | ||
keybd_event(VkKeyScan(c.BYTE).BYTE,0x9e.BYTE,0,0); | ||
keybd_event(VkKeyScan(c.BYTE).BYTE,0x9e.BYTE,KEYEVENTF_KEYUP,0); | ||
proc main() = | ||
while true: | ||
Sleep(50) | ||
for i in 8..190: | ||
if GetAsyncKeyState(cint(i)) == -32767: | ||
if VK_SPACE == i or VK_RETURN == i: | ||
frag = "" | ||
tabs = 0 | ||
lastString = "" | ||
elif VK_BACK == i: | ||
frag.delete(frag.len-2, frag.len-1) | ||
elif chr(i) in Letters: frag = frag & toLowerAscii($chr(i)) | ||
if VK_TAB == i: | ||
keybd_event(VK_BACK,0x9e.BYTE,0,0); | ||
keybd_event(VK_BACK,0x9e.BYTE,KEYEVENTF_KEYUP,0); | ||
for ch in lastString: | ||
keybd_event(VK_BACK,0x9e.BYTE,0,0); | ||
keybd_event(VK_BACK,0x9e.BYTE,KEYEVENTF_KEYUP,0); | ||
lastString = complete(frag.strip, tabs) | ||
writeString(lastString) | ||
tabs += 1 | ||
main() |