Autohotkey-从HTML复制并在Word中粘贴



我是Autohotkey的新手,因此需要您的耐心。

我有一个带有6236个单独HTML文件的文件夹;每个都包含一个句子。

这些文件的名称如下:001001,001002,001003,...,001007,002001,002002,002003等。当然,使用.html文件格式。

我想编写一个带有热弦的脚本,例如:

:*:001001::

:*:001002::

等等,因此,当我在单词中键入001001时,将001001.html的内容粘贴到单词中。当我键入001002时,它将001002.html的内容粘贴到单词中。对于所有6236个文件,这种方式。

您能帮我吗?

主代码

 loop,6236
 {
 number := 001000 + A_Index
 number := "00" . number
 temptext1 :=":*:" . number . "::"
 temptext2 := "FileRead, orgtext, C:" . number . ".html"
 temptext3 := "SendInput % orgtext"
 temptext4 := "return"
 temptext := temptext . temptext1 . "`n" . temptext2 . "`n" . temptext3 . "`n" . temptext4 . "`n`n"
 }
FileAppend, %temptext%, C:test.ahk

循环1将创建以下文本

:*:001001::
FileRead, orgtext, C:01001.html
SendInput % orgtext
return

循环2将创建

:*:001002::
FileRead, orgtext, C:01002.html
SendInput % orgtext
return

等到007236。您需要更改HTML文件的位置。我假设C: 001001.html。例如,如果文件在c: program文件 myhtmlfiles 001001.html中,则将第6行编辑为:

temptext2 := "FileRead, orgtext, C:Program FilesMyhtmlfiles" . number . ".html"

这是一个很长的循环,因此需要几秒钟才能完成。循环完成后,将结果保存到测试中。

最新更新