////////////////////////////////////函数与子过程////////////////////////////////////
//取得文本文件的行数,包括空白行
Function GetTxtCount(filePath)
	fileLen=Plugin.File.GetFileLength(filePath)   
	handle=Plugin.File.OpenFile(filePath)     
	Call Plugin.File.SeekFile(handle,1)   
	
	str = Plugin.File.ReadLine(handle)
	
	i = 0
	
	Do While trim(str) <> ""
		
		str = Plugin.File.ReadLine(handle) 	
		
		i = i + 1
	Loop
	
	
	Call Plugin.File.CloseFile(handle) 
	
	GetTxtCount = i
	  
End Function

//往文本文件追加一行
Sub AppendTXTString(filePath, str)
	fileLen=Plugin.File.GetFileLength(filePath)   
	handle=Plugin.File.OpenFile(filePath)     
	Call Plugin.File.SeekFile(handle,fileLen)   
	Call Plugin.File.WriteLine(handle,str)   
	Call Plugin.File.CloseFile(handle) 
	  
End Sub

//取随机数 
Function rndInt(lowerbound, upperbound)
	rndInt = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
End Function
   

Sub TypeString(str)  
	s = ""
	If Len(str) > 0 Then
	
		i = 1 
    	For Len(str)
    		s =	atos( Mid(str, i, 1) )
    		Delay 50
			KeyDown s, 1
			Delay 50
			KeyUp s, 1
			Delay 50
			
  
			i = i+1 		
		next	
	
	End If

    TypeString = str      
End Sub

Function atos(a)
	if a = "1"	then
		atos = "Num 1"	
	End If
	if a = "2"	then
		atos = "Num 2"	
	End If
	if a = "3"	then
		atos = "Num 3"	
	End If
	if a = "4"	then
		atos = "Num 4"	
	End If	
	if a = "5"	then
		atos = "Num 5"	
	End If
	if a = "6"	then
		atos = "Num 6"	
	End If
	if a = "7"	then
		atos = "Num 7"	
	End If
	if a = "8"	then
		atos = "Num 8"	
	End If		
	if a = "9"	then
		atos = "Num 9"	
	End If
	if a = "0"	then
		atos = "Num 0"	
	End If	
	
	If a = "a" then
		atos = "A"
	End If
	If a = "b" then
		atos = "B"