zoukankan      html  css  js  c++  java
  • 给从论文复制的文本设置正确的格式(可设置快捷键)

    download :

    https://pan.baidu.com/s/11_7AvdBJZllMhLEG09qrbQ

    https://github.com/congmingyige/ClipboardContentChange

    思路来自于https://blog.csdn.net/m0_37864814/article/details/85255097,

    但其缺少设置快捷键的方法,于是自己尝试写了一下代码。

    P.S.:

    剪贴板

    Ditto

    windows10 剪贴板 https://baijiahao.baidu.com/s?id=1617354553440448877&wfr=spider&for=pc

    如 复制以下文本

    得到的是

    Our deep learning-based approach
    works reliably despite variations in signal
    intensities, outperforming previous filter-based
    methods and reaching the quality of segmentations
    of human annotators.

    如在google搜索, 情况是

    需要

    1.从剪贴板获得文本

    2.把' '(如在Codeblocks能看到’ ')换为' '

    3.把文本放入剪贴板

     1 #include <stdio.h>
     2 #include <assert.h>
     3 #include <windows.h>
     4 
     5 #ifdef _MSC_VER
     6 #pragma comment( linker, "/subsystem:"windows" /entry:"mainCRTStartup"" )
     7 #endif
     8 
     9 int main()
    10 {
    11 
    12     char *url,*pData,*pr;
    13     size_t length,len;
    14     int i;
    15 
    16     ///get data
    17     ///from https://zhidao.baidu.com/question/682834457977004412.html
    18     OpenClipboard(NULL);
    19     HANDLE hData=GetClipboardData(CF_TEXT);
    20 //    assert(hData!=NULL);
    21     length=GlobalSize(hData);
    22     url=(char*)malloc(length+1);
    23     pData=(char*)GlobalLock(hData);
    24     strcpy(url,pData);
    25     GlobalUnlock(hData);
    26     CloseClipboard();
    27     url[length]=0;
    28 //    printf("%s
    ",url);
    29 
    30 //    for (i=0;i<length;i++)
    31 //        printf("%c",url[i]);
    32 //    printf("
    
    
    ");
    33 
    34     len=0;
    35     pr=(char*)malloc(length+1);
    36     for (i=0;i<length;i++)
    37         ///'
    ' replace with ' '
    38         if (url[i]!='
    ' && url[i]!='
    ')
    39             pr[len++]=url[i];
    40         else if (url[i]=='
    ')
    41             pr[len++]=' ';
    42 
    43     pr[len]=0;
    44 
    45 //    for (i=0;i<len;i++)
    46 //        printf("%c",pr[i]);
    47 //    printf("
    
    
    ");
    48 
    49     ///write data
    50     ///from https://zhidao.baidu.com/question/647698977954822045.html
    51     if(OpenClipboard(NULL))
    52     {
    53         EmptyClipboard();
    54         HGLOBAL clipbuffer;
    55         char *buffer;
    56         clipbuffer = GlobalAlloc(GMEM_DDESHARE, len+1);
    57         buffer = (char *)GlobalLock(clipbuffer);
    58         strcpy(buffer, pr);
    59         GlobalUnlock(clipbuffer);
    60         SetClipboardData(CF_TEXT, clipbuffer);
    61         CloseClipboard();
    62     }
    63 
    64 
    65     return 0;
    66 }

    生成exe

    设置快捷键

    但是出现了运行窗口一闪而过的问题,

    不知道为什么,用exe和bat都无法解决这个问题(windows系统),使用了vbs文件。

    其中vbs文件要与exe文件在同一目录下。这样最方便,不用写完整路径。

    1 set ws=wscript.createobject("wscript.shell")
    2 
    3 ws.run "ClipboardContentChange.exe /start",0

    创建了快键方式才能设置快捷键。

    在开始菜单或者桌面才生效。

    桌面上的文件,设置快捷方式

     

    有些快捷键无法使用,自然设置了(键盘按快捷键)也无反应。

    对于快捷键的设置

    https://zhidao.baidu.com/question/224402258.html

     vbs要运行exe,所以起始位置一定要设置(发送到桌面快捷方式,已经默认设置了)

    可以看一下当前操作系统快捷键的情况

    https://jingyan.baidu.com/article/c275f6ba32375ce33c756747.html

    win10 千万勿用!!!

  • 相关阅读:
    python高阶1--is 和==
    python基础知识 -- 输入与输出
    Linux忘记用户名密码
    pip 安装第三方库报错
    python读取ini文件(含中文)
    fiddler之手机抓包
    python接口测试之参数关联遇到的问题
    (十一)TestNG 其他使用技巧
    (十二)TestNG 生成测试报告
    (十) TestNG 多线程运行用例
  • 原文地址:https://www.cnblogs.com/cmyg/p/11442696.html
Copyright © 2011-2022 走看看