autohotkey +vba 利用文本文件传递数据(2)-中断与延时

#x::Ext:=1
;Send, {LAlt Down}
;send {PGDN}
;send {lalt up}
;Sleep, 100


#z:: ;Run www.autohotkey.com
SetTitleMatchMode 2
Num:=0
Err:=0
Ext:=0
tt=
FileDelete ,D:\temp.txt
Loop
{
	times:=0
	MouseClick, left, 350,  184,2 ; 335,  190,2
	clipboard=
	Loop
	{
		if(Ext=1)
			break
		Sleep, 500
			send  ^c
			Sleep 200   ;;;;;;;;发指令需要时间important!!!			
		if( StrLen(Clipboard)<1)
		{
			times:=times+1
			if(times>=20)
			{
				MsgBox 选择销售单超时
				;break	
				return
			}
		}
		else
			break
	}
	if(Ext=1)
	{
		MsgBox 强制退出
		Ext:=0
		break
	}	
	if (tt=Clipboard)
	{
		MsgBox 数据处理完成
		tt=
		break
	}
	tt=%Clipboard%
	;send #c
	;Sleep 500  ;;;;;;;;发指令需要时间important!!!
	;--------------------------------------------
  {	
	FileDelete ,D:\temp.txt
	;send ^c  ;;;;
	;Sleep 100 ;;;;
	FileAppend,%Clipboard%, D:\temp.txt
	FileAppend,;, D:\temp.txt
	MouseClick, Left ,1084,228,2 ;570,235,2
	sleep 300
	send ^a
	Sleep 200
	send  ^c
	Sleep 200
	FileAppend,%Clipboard%, D:\temp.txt
	FileAppend,;, D:\temp.txt
	MouseClick, Left ,840,250,2 ;1580,235,2
	sleep 300
	send ^a
	Sleep 200
	send  ^c
	Sleep 200
	FileAppend,%Clipboard%, D:\temp.txt
	FileAppend,;, D:\temp.txt
	MouseClick, Left ,840,274,2 ;335,280,2
	sleep 300
	send ^a
	Sleep 200
	send  ^c
	Sleep 200
	FileAppend,%Clipboard%, D:\temp.txt	
	FileAppend,;, D:\temp.txt
	MouseClick, Left ,580,184,2 ;570,190,2
	sleep 300
	send ^a
	Sleep 200
	send  ^c
	Sleep 200
	FileAppend,%Clipboard%, D:\temp.txt	
	FileAppend,`n, D:\temp.txt
	;msgbox 销售单数据已经拷贝入D:\temp.txt,请点击下面的单据统计销售件数	
  }		
	;--------------------------------------------
	MouseClick, Left ,760,408,1 ;765,390,1
	Sleep, 300
	;send #v
	;Sleep 100 ;;;;;;;;;
	;--------------------------------------------
	{	
	send ^a
	Sleep 200
	send ^c
	Sleep 200
	ttt=%Clipboard%
	FileAppend,%Clipboard%, D:\temp.txt
	;FileAppend,`n, D:\temp.txt
	IfWinExist 四川科伦每天销售发货明细
	{
		WinActivate
		WinWaitActive
		send ^+l
		Sleep 1000
	}	
	else{
		MsgBox,四川科伦每天销售发货明细没打开
		Err:=1  
		return
	}  	
  }		
	;--------------------------------------------
	;if(Err=0){
		WinMinimize,四川科伦每天销售发货明细
	;}
	;break	;;;;;;;;不管是否成功都需要退出一个循环!!!		
	Num:=Num+1
	if(Num>=50)
	{
		MsgBox 销售单达到了50条,请确认
		break
	}
	Send, {LAlt Down}
	Sleep 200
	send {PGDN}
	Sleep 200
	send {lalt up}
	Sleep, 200	
}
return

#c::
SetTitleMatchMode 2
;IfWinActive,UFIDA NewCentury
{	
	FileDelete ,D:\temp.txt
	send ^c  ;;;;
	Sleep 100 ;;;;
	FileAppend,%Clipboard%, D:\temp.txt
	FileAppend,;, D:\temp.txt
	MouseClick, Left ,1084,228,2 ;570,235,2
	sleep 300
	send ^a
	Sleep 200
	send  ^c
	Sleep 200
	FileAppend,%Clipboard%, D:\temp.txt
	FileAppend,;, D:\temp.txt
	MouseClick, Left ,840,250,2 ;1580,235,2
	sleep 300
	send ^a
	Sleep 200
	send  ^c
	Sleep 200
	FileAppend,%Clipboard%, D:\temp.txt
	FileAppend,;, D:\temp.txt
	MouseClick, Left ,840,274,2 ;335,280,2
	sleep 300
	send ^a
	Sleep 200
	send  ^c
	Sleep 200
	FileAppend,%Clipboard%, D:\temp.txt	
	FileAppend,;, D:\temp.txt
	MouseClick, Left ,580,184,2 ;570,190,2
	sleep 300
	send ^a
	Sleep 200
	send  ^c
	Sleep 200
	FileAppend,%Clipboard%, D:\temp.txt	
	FileAppend,`n, D:\temp.txt
	;msgbox 销售单数据已经拷贝入D:\temp.txt,请点击下面的单据统计销售件数	
}
;else
;	msgbox,UFIDA NewCentury 没激活
return

#v::
SetTitleMatchMode 2
;IfWinActive,UFIDA NewCentury
{	
	send ^a
	Sleep 200
	send ^c
	Sleep 200
	ttt=%Clipboard%
	FileAppend,%Clipboard%, D:\temp.txt
	;FileAppend,`n, D:\temp.txt
	IfWinExist 四川科伦每天销售发货明细
	{
		WinActivate
		WinWaitActive
		send ^+l
		Sleep 200
	}	
	else{
		MsgBox,四川科伦每天销售发货明细没打开
		Err:=1  
	}  	
}
;else
;	msgbox,UFIDA NewCentury 没激活
return


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值