全自动化准备XML文档

 喜欢的话考去用用,不过先声明,对本程序造成的后果我不负责任哦。
'click
If Wscript.Arguments.Count=0 Then  
Msgbox "This Version is extreme dangerous, and it maybe harmful to your computer."+ chr(13)+_
		"Please make sure this vbs is in the same folder of your xml file.",48,"prompt"  
Wscript.Quit  
End If  

'start
set wshell = CreateObject("Wscript.Shell")

'For i=0 to Wscript.Arguments.Count-1  
	singlePath=Wscript.Arguments(0)  
'next

'start wordpad
with wshell
	.Run "wordpad """ + singlePath + """"
	Wscript.Sleep 1000
	
	.SendKeys("%")
	Wscript.Sleep 100
	.SendKeys("f")
	Wscript.Sleep 100
	.SendKeys("a")
	Wscript.Sleep 100
	.SendKeys("{TAB}")
	Wscript.Sleep 100
	.SendKeys("{DOWN}")
	Wscript.Sleep 100
	.SendKeys("{UP}")
	Wscript.Sleep 100
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	.SendKeys("%{F4}")
end with

	 Wscript.Sleep 1000
	 
'START word

rtfpaths = split(singlePath,".")
rtfpath = rtfpaths(0)+".rtf"

with wshell
	.Run "winword """ + rtfpath + """"
	Wscript.Sleep 2000
	'if you have no sadd..style plz del this module
	.SendKeys("%{F8}")
	Wscript.Sleep 100
	.SendKeys("s")
	Wscript.Sleep 100
	.SendKeys("a")
	Wscript.Sleep 100
	.SendKeys("{DOWN}")
	Wscript.Sleep 100
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	'----------------------------
	Wscript.Sleep 1000
	
	.SendKeys("%")
	Wscript.Sleep 100
	.SendKeys("e")
	Wscript.Sleep 100
	.SendKeys("f")
	enter_text("/<*/>")
	Wscript.Sleep 100
	.SendKeys("{TAB}")
	Wscript.Sleep 100
	.SendKeys(" ")
	Wscript.Sleep 100
	
	send_key_by_time "{TAB}",2

	.SendKeys(" ")
	Wscript.Sleep 100
	send_key_by_time "{TAB}",4
	
	.SendKeys(" ")
	Wscript.Sleep 100
	
	send_key_by_time "+{TAB}",2
	.SendKeys(" ")
	Wscript.Sleep 100
	.SendKeys("%{F4}")
	Wscript.Sleep 100
	
	'set style
	call_style
	send_key_by_time "{DOWN}",6
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	
	'------------------------here may not be use or should be modified---------------
	send_key_by_time "{ESC}",4
	
	send_word_search
	' enter text
	enter_text("text=""*""")
	send_key_by_time "{TAB}",4
	.SendKeys(" ")
	Wscript.Sleep 100
	.SendKeys("%{F4}")
	Wscript.Sleep 100
	
	' set style = clear
	call_style
	send_key_by_time "{UP}",6
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	
	'seasrch text="
	send_word_search
	enter_text("text=""")
	send_key_by_time "{TAB}",4
	.SendKeys(" ")
	Wscript.Sleep 100
	.SendKeys("%{F4}")
	Wscript.Sleep 100
	
	call_style
	send_key_by_time "{DOWN}",6
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	'search "/>
	send_word_search
	enter_text("""/>")
	send_key_by_time "{TAB}",6
	send_key_by_time " ",1
	send_key_by_time "+{TAB}",3
	send_key_by_time " ",3
	.SendKeys("%{F4}")
	Wscript.Sleep 100
	
	call_style
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	
	' search &*;
	send_word_search
	enter_text("&*;")
	send_key_by_time "{TAB}",7
	send_key_by_time " ",1
	send_key_by_time "+{TAB}",2
	send_key_by_time " ",3
	.SendKeys("%{F4}")
	Wscript.Sleep 100
	
	
	call_style
	send_key_by_time "{DOWN}",1
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	
	send_word_search
	.SendKeys("+5") '%
	enter_text("[0-9a-zA-Z]")
	send_key_by_time "{TAB}",4
	send_key_by_time " ",4
	.SendKeys("%{F4}")
	Wscript.Sleep 100
	
	call_style
	.SendKeys("{ENTER}")
	Wscript.Sleep 100
	'--------------------------END----------------------------------
	Wscript.Sleep 1000
	
	.SendKeys("%{F4}")
	Wscript.Sleep 100
	.SendKeys("y")
	Wscript.Sleep 100
end with

' subs
sub call_style
	set wshell = CreateObject("Wscript.Shell")
	with wshell
		.SendKeys("%")
		Wscript.Sleep 100
		.SendKeys("o")
		Wscript.Sleep 100
		.SendKeys("s")
		Wscript.Sleep 100
	end with
end sub

sub enter_text(textin)
	set wshell = CreateObject("Wscript.Shell")
	wshell.SendKeys(textin)
	Wscript.Sleep 100
end sub

sub send_word_search
	set wshell = CreateObject("Wscript.Shell")
	wshell.SendKeys("^f")
	Wscript.Sleep 100
end sub

sub send_key_by_time(keyname,times)
	set wshell = CreateObject("Wscript.Shell")
	for ic=0 to times-1
		wshell.SendKeys(keyname)
		Wscript.Sleep 100
	next
end sub
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值