自己研究的自动的打字机
效率大概在700字/min吧
源码cpp:
#include<iostream>
#include<cstdio>
#include<windows.h>
using namespace std;
void PutKeyState(char ch){
if(ch==' '){
keybd_event(VK_TAB,(BYTE)0, 0 ,0);
keybd_event(VK_TAB, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch==';'){
keybd_event(186,(BYTE)0, 0 ,0);
keybd_event(186, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch==','){
keybd_event(188,(BYTE)0, 0 ,0);
keybd_event(188, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch=='.'){
keybd_event(190,(BYTE)0, 0 ,0);
keybd_event(190, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch==39){
keybd_event(222,(BYTE)0, 0 ,0);
keybd_event(222, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch=='"'){
keybd_event(VK_SHIFT,(BYTE)0, 0 ,0);
Sleep(10);
keybd_event(222,(BYTE)0, 0 ,0);
keybd_event(222, (BYTE)0, KEYEVENTF_KEYUP,0);
Sleep(10);
keybd_event(VK_SHIFT, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch=='
'){
keybd_event(VK_RETURN,(BYTE)0, 0 ,0);
keybd_event(VK_RETURN, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch==' '){
keybd_event(VK_SPACE,(BYTE)0, 0 ,0);
keybd_event(VK_SPACE, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch>='A' and ch<='Z'){
keybd_event(VK_SHIFT,(BYTE)0, 0 ,0);
Sleep(10);
keybd_event(ch,(BYTE)0, 0 ,0);
keybd_event(ch, (BYTE)0, KEYEVENTF_KEYUP,0);
Sleep(10);
keybd_event(VK_SHIFT, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch>='0' and ch<='9'){
keybd_event(ch,(BYTE)0, 0 ,0);
keybd_event(ch, (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
if(ch>='a' and ch<='z'){
keybd_event(ch-'a'+'A',(BYTE)0, 0 ,0);
keybd_event(ch-'a'+'A', (BYTE)0, KEYEVENTF_KEYUP,0);
return;
}
keybd_event(VK_SPACE,(BYTE)0, 0 ,0);
keybd_event(VK_SPACE, (BYTE)0, KEYEVENTF_KEYUP,0);
}
char ch;
int main(){
freopen("get.txt","r",stdin);
Sleep(10000);
while(scanf("%c",&ch)!=EOF){
PutKeyState(ch);
}
return 0;
}