首页 > 其他分享 >autohotkey 发送到 word

autohotkey 发送到 word

时间:2022-09-04 21:24:01浏览次数:58  
标签:Selection word autohotkey content oWord exe document 发送到



GroupAdd auo_gruop, ahk_exe msedge.exe 
GroupAdd auo_gruop, ahk_exe chrome.exe
GroupAdd auo_gruop, ahk_exe snipaste.exe
GroupAdd auo_gruop, ahk_exe mspaint.exe

#IfWinActive  ahk_group auo_gruop
{
    ; 添加到word
    !CapsLock::add2word()
    ; 查词
    `::searchWord()
}


add2word(){
    ; 将图片复制到粘贴板
    Send ^c
    ; t 用来存放标题
    InputBox, title, TITLE, , , 600,100,50,100
    InputBox, content, CONTENT, , , 600,100,50,100
    if ErrorLevel
        MsgBox, CANCEL was pressed.
    else
       ; 如果标题为空,则返回
        if title=
        {
            Return
        }
        ; 如果内容为空,则继续,为内容赋值空串,防止后面报错
        if content=
        {
            content:=""
        }
        insertTitle(title)
        insertPic()
        insertContent(content)
}

insertTitle(real_title){
    ; active the document was opened
    oWord := ComObjActive("Word.Application")
    oWord.Selection.TypeParagraph
    ; add some split while line
    oWord.Selection.TypeText(real_title)
    ; save the active word document
    oWord.ActiveDocument.Save
}
insertPic(){
    ; clipboard =  ; 让剪贴板初始为空, 这样可以使用 ClipWait 检测文本什么时候被复制到剪贴板中.

    ; ClipWait
    ; active the document was opened
    oWord := ComObjActive("Word.Application")
    oWord.Selection.TypeParagraph
    ; paste the clipboard to the word document
    oWord.Selection.Paste
    ; save the active word document
    oWord.ActiveDocument.Save
}

insertContent(content){
    ; active the document was opened
    oWord := ComObjActive("Word.Application")
    oWord.Selection.TypeParagraph

    content_arr := StrSplit(content, "  ")
    For index, value in content_arr{
        content_new := index ". " value "`n"
        ; add some split while line
        oWord.Selection.TypeText(content_new)
    }
    oWord.Selection.TypeText("---------------------------------------------------`n")
    oWord.Selection.TypeParagraph
    ; save the active word document
    oWord.ActiveDocument.Save
    ToolTip, add
    SetTimer, RemoveToolTip, -1000
    return
    RemoveToolTip:
    ToolTip
    return
}

searchWord(){
    Click right
    SendInput, {Up 3}
    SendInput, {Enter}
}


#w::Suspend

标签:Selection,word,autohotkey,content,oWord,exe,document,发送到
From: https://www.cnblogs.com/zhuoss/p/16656132.html

相关文章

  • OFFCE_WORD笔记
    二级或者三级标题是1而不是1.1怎么改点击段落里面的“多级列表”那个小的倒三角形选中带有“章”字的多级列表就可以啦此时样式这里也会发生变化......
  • Why No Password Is Better than One Password 文章学习
    WhyNoPasswordIsBetterthanOnePassword是由curity团队写的一篇文章,说明了NoPassword的一种实践详细的参考链接,以下是一些整理什么是无密码界面中不需要输入任......
  • [Google] LeetCode 2135 Count Words Obtained After Adding a Letter
    Youaregiventwo0-indexedarraysofstringsstartWordsandtargetWords.EachstringconsistsoflowercaseEnglishlettersonly.ForeachstringintargetWord......
  • 【Word】如何批量导出ppt中的备注
    【Word】如何批量导出ppt中的备注文件|导出|创建讲义|备注在幻灯片旁在word中删除左边两列,复制剩下的表格|粘贴-只保留文本......
  • C# 调用word进程操作文档关闭进程
    程序后台调用word设置word可以被程序调用,其实就是权限问题,这个一般要设置服务器的用户和netword用户。到com组件里面设置。操作word1.Microsoft.Office.Interop.Wo......
  • CF1511 F. Chainword / G. Chips on a Board
    F太屑了,没写如果直接暴力记矩阵的话是40*40=1600边长,显然不行发现如果上下都没有匹配结束,则后面的字母是唯一确定的(按位比较,不同则无解)设f[i,x]表示串长i,一边匹配到x,则......
  • WordPress的网站链接,如何去掉index.php和category?
    使用WordPress搭建网站时,如果你是基于IIS服务器搭建的,肯定会遇到这个问题,就是固定链接设置好后,网址会出现烦人的index.php和category这两个关键字。  举个例子,博客的分......
  • 【MySQL】Authentication plugin 'caching_sha2_password' reported error
    使用MySQL8.0.30创建主从,启动从库的时候报错:Last_IO_Errno:2061Last_IO_Error:errorconnectingtomater'repl@xxxxx:3308'-retry-time:60retries:1massage:Authe......
  • 打开WordPress网站时,出现Http500错误怎么办?
    在用PHP+IIS+WordPress搭建博客系统时,我们最不想看到的就是报错,尤其是http500的错误,有时真是一头雾水,摸不到头脑。有时升级主题或插件,也会莫名其妙的报这个错误,对于没有编......
  • WordPress美女图集COS写真整站自适应网站源码带完整数据
    这是自己做的网站,因为自己要做别的业务,没有时间打理,而且放着也是放着,不如拿来分享给大家,这个资源非常火爆,用来引流还是很轻松的。 网站从服务器备份了下来,所以有完整......