案例:在一张网页上有许多你要复制的内容,但是你必须一个一个找到他们,然后一个一个复制出来粘贴到excel表格里。时间一长你的眼睛容易花,而且复制多了容易出错。
方法:当然有许多方法可以自动化的做这一件事情。网页上可以利用tg元素来获取,但是这个网页只能是google浏览器打开。
我们干脆偷个懒,直接复制全部内容,然后用程序来查找,根据表格要求进行输出。
思路:
把文本(网页上的或者是其他应用上的)整个复制下来,
输出给剪贴板
正则查找,生成新的文本文件
直接以tab单元形式输出到剪贴板
#include<Date.au3> $starday = "2017/4/22" ;测试开始时间
$iDateCalc = _DateDiff('d', $starday, _NowCalc())
If $iDateCalc < And $iDateCalc >= Then
Break()
Else
MsgBox(, "警告:", "超过测试版本的使用期限,请到淘宝:“维尼熊的百宝箱”购买正式版本!")
Exit
EndIf HotKeySet("{F9}", "qianniu")
HotKeySet('{ESC}', 'FNC_EXIT')
While
Sleep()
WEnd
;~ if "microsof-fb686a"=$PublicIP then Func qianniu()
Sleep()
Send("{CTRLDOWN}")
Sleep()
Send("a")
Sleep()
Send("c")
Sleep()
Send("{CTRLUP}") $var = ClipGet() If = StringRegExp($var, '订单管理', ) Then
Return MsgBox(, "注意", "你没有粘贴飞牛冲值内容")
Else
$text2 = StringRegExp($var, '(\d{16,17})\r', ) ;$text2[]
;$text4 =StringRegExp($var,'留言: \R(.+)',)
$text4 = StringRegExp($var, '\D(\d{12})\D|\D(\d{8})\D', )
;~ $text4 =StringRegExp($var,'\D(\d\d\d\d\d\d\d\d)|\D(\d\d\d\d\d\d\d\d\d\d\d\d)',)
$text5 = StringRegExp($var, '实付:(.+)元', ) ;$text2[]
$text7 = StringRegExp($var, '(1\d\d\d\d\d\d\d\d\d\d)\D', );$text2[]
$text1 = @MON & "月" & @MDAY & "日"
$text3 = ""
$text6 = ""
$text8 = "" If = StringRegExp($var, '(\d{16,17})\r', ) Then
$txt2 = " "
Else
$txt2 = $text2[]
EndIf If = StringRegExp($var, '\D(\d{12})\D|\D(\d{8})\D', ) Then
$txt4 = " " Else
$txt4 = ""
For $i = To UBound($text4) -
$txt4 = $txt4 & " "
$txt4 = $txt4 & $text4[$i]
Next EndIf If = StringRegExp($var, '实付:(.+)元', ) Then
$txt5 = " "
Else
$txt5 = $text5[]
EndIf If = StringRegExp($var, '(1\d\d\d\d\d\d\d\d\d\d)\D', ) Then
$txt7 = " "
Else
$txt7 = $text7[]
EndIf ClipPut($text1 & " '" & $txt2 & " " & $text3 & " " & $txt4 & " " & $txt5 & " " & $text6 & " " & $txt7 & " " & $text8)
EndIf
Sleep()
EndFunc ;==>qianniu Func FNC_EXIT()
Exit
EndFunc ;==>FNC_EXIT
程序操作:1、鼠标选中需要操作的界面,利用f9键,来完成程序操作。2、直接粘贴到表格里面,成为一行的内容