zoukankan      html  css  js  c++  java
  • 键盘自动机

    自己研究的自动的打字机

    效率大概在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;
    }
    
  • 相关阅读:
    各种机器学习方法概念
    深入理解拉格朗日乘子法(Lagrange Multiplier) 和KKT条件
    肤色识别
    创建自己的窗口消息
    模糊C均值
    Fisher线性判别
    用遗传算法加强足球游戏的人工智能
    人工智能-遗传算法解决推箱子问题现实
    LBP特征
    VC 制作系统托盘程序实现将窗口最小化到系统托
  • 原文地址:https://www.cnblogs.com/ezoihy/p/8899646.html
Copyright © 2011-2022 走看看