当前位置: 代码迷 >> 综合 >> 按键精灵,批量传包工具源码备份
  详细解决方案

按键精灵,批量传包工具源码备份

热度:89   发布时间:2024-01-10 07:31:21.0

// 获取当前路径
curDir = Plugin.Sys.GetDir(0)
//curDir = "D:\sci\按键精灵\乐堂批量传包"
curDir = Replace(curDir, "\配置信息", "")
Call Plugin.Msg.Tips("获得路径:" & curDir)
//MessageBox "获得路径:" & curDirautoLogin = "1"		// 标记是否自动登录
MouseLeft = "2"		// 鼠标左右键设置configFile = curDir & "\配置信息\熊出没2(默认配置).txt"
tittle = "配置信息"
loginPageTittle = "登录_中国移动开发者社区 - 360极速浏览器"
myAppPageTittle = "我的应用 - 中国移动开发者社区 - 360极速浏览器"// 选择apk文件对话框配置
openApkTittle = "选择要上载的文件,通过: dev.10086.cn"
openDialogType = "2"debugMode = 0Dim hwnd			// 定义句柄
Dim Ux, Uy			// 浏览器坐标
Dim charges
Ux = - 1 
Uy = -1Dim colorPosX 			// 记录颜色值函数查找颜色后获取到的坐标
Dim colorPosYLoginWait_Color = "E5E8C0"	// 登录界面提示颜色值// 添加程序包按钮坐标
pos2_X = 345
pos2_Y = 435//435  // 625
pos2_Color = "D08500"WaitforColor_Home = 0		// 标识在等待颜色值时,是否向上翻页 1, 不翻页0
AutoMoveToPoint_add = 0		// 标识是否自动移动到添加按钮坐标处// 上传程序包按钮坐标
pos3_X = 500
pos3_Y = 805
pos3_Color = "D08500"apkFinishColor = "0BAF7A"	// apk包上传完成颜色值//证书签名坐标定位
SignPageDown = 4		// 向下翻页次数
SignDownArrow = 4		// 先下移动次数// 证书签名坐标
pos1_X = 500
pos1_Y = 685
Pos1_Color = "0BAF7A"	// 证书上传完成颜色值// 计费点坐标信息
ChargePoints_X = 500
ChargePoints_Y1 = 310
ChargePoints_Y2 = 198
ChargePoints_Y3 = 185// 计费点偏移值
ChargePoints_num1 = 17	// 第一页最大计费点数
ChargePoints_num2 = 45  // 第二页最大计费点数packagePath = curDir & "\游戏包\熊出没2"
chargesAll = "1,3,5,7,10,21,23,28,41,42,44,45,47,52,57"	// 计费点信息
charges1 = "1,3,5,7,10,21"		// 计费点1到21
charges2 = "23,28,41,42,44,45"	// 计费点22到45	
charges3= "47,52,57"			// 计费点46到以上selectCharge = 0		// 标识当前是否处于选择计费点逻辑中// ---------------------------------
// 内部变量Mobile_Market = 0		// 移动应用商场 0不选中、1选中ClickColor_queding = "D08500"	// 确定按钮颜色值
If_Color_Click_count = 0		// 重复点击次数
apk_name="程序包名称 *.apk"		// 程序包名
indexUp = 0						// 当前上传的程序包索引ColorPos2_flag = 0				// 上传完成坐标位置2,按钮颜色值偏移标记值
ColorPos2_Color	= "AAAA"		// 上传完成坐标位置2,颜色值
ColorPos2 = 0					// 上传完成,在坐标2处,对界面布局颜色值位置偏移值//Call WriteConfig()			// 保存当前配置信息到文件Call ALL()
//Call UpLoad(packagePath)		// 上传目录下的所有apkb包// 功能测试
//Call selectApk("D:\乐堂批量传包\packages\熊出没2", 4, 500, 805)	// 选择apk包
//call WaitForColor(500+100, 805+22, "0BAF7A")//Call UpLoadSign(2, 14, 500, 644)// 用自己的证书做包签名
//Call UpLoadSign(4, 4, 500, 685)// 用自己的证书做包签名
//Call Move_To(500 - 50, 685 - 493)//Call FindColorInRect(500 - 50, 685 - 493, 30, 30, "009AFF", intX, intY)
//Call SelectRecentPics(500 - 50, 685 - 493)// 选中使用最近上传截图//Call FindColorInRect(523, 468, 30, 30, "0059EC", intX, intY)
//If intX > 0 And intY > 0 Then //Call Plugin.Msg.Tips("apk上传完成!")
//End If//names = GetFilesNames(packagePath)EndScript//-----------------------------------------------------------
// 以下为定义的功能函数
//-----------------------------------------------------------Sub ALL()Call SelectConfig()				// 选择配置文件If getDefaultConfig = "1" Then Call WriteConfig()			// 保存当前配置信息到文件Else If autoLogin = "1" ThenCall CheckLogin()		// 登录逻辑End IfCall checkPath()			// 先检查apk路径是否存在,不存在则先创建Call UpLoad(packagePath)	// 批量上传程序包End IfEnd Sub// 上传path下所有apk包
Sub UpLoad(path)indexUp = 0Dim UpLoad_NumUpLoad_Num = GetFilesNum(path)//获取给定目录下的apk文件数目Call Plugin.Msg.Tips("文件夹" & path & "下" & vbcrlf & "程序包数目:" & UpLoad_Num)Delay 3000If UpLoad_Num = 0 ThenMessageBox "请先将apk包添加到目录:[" & path & "]中,再重新运行此脚本"Elsenames = GetFilesNames(path)For UpLoad_Num//str1 = left & ", " & topapk_name = names(indexUp)indexUp = indexUp + 1Call Plugin.Msg.Tips("上传程序包:" & indexUp & "/" & UpLoad_Num &  vbcrlf & vbcrlf & apk_name)Delay 1000Call CheckUpLoadPage()					// 进入我的应用传包界面Call selectApk(path, apk_name, indexUp) // 选择apk包//Call Move_To(pos3_X + 100, pos3_Y + 22)//Delay 20000apkInfo1 = "apk包上传中" &  vbcrlf & indexUp & "/" & UpLoad_Num &  vbcrlf & apk_nameapkInfo2 = "apk包上传完成" & vbcrlf & indexUp & "/" & UpLoad_Num & vbcrlf & apk_nameColorPos2_flag = 1				// 判定颜色位置2Call WaitForColor(pos3_X + 100, pos3_Y + 22, apkFinishColor, apkInfo1 ,apkInfo2) // 等待apk包上传完成,相对于上传包按钮的坐标Call ChargePoints()						// 选择计费点Delay 100Call UpLoadSign(SignPageDown, SignDownArrow, pos1_X, pos1_Y + ColorPos2)	// 用自己的证书做包签名// 输入签名信息//Call Input_String(left, top+120, "letang123")//Call Input_String(left, top+170, "letang123")//Call Input_String(left, top + 220, "letang")// 输入签名信息Call Input_String1(pos1_X, pos1_Y + 120 + ColorPos2, 1)Call Input_String1(pos1_X, pos1_Y + 170 + ColorPos2, 1)Call Input_String1(pos1_X, pos1_Y + 220 + ColorPos2, 2)Call SelectRecentPics(pos1_X - 50, pos1_Y - 493 + ColorPos2)		// 相对于UpLoadSign选择后,进行选中,使用最近上传截图Delay 100If (Mobile_Market = 0) Then Call Click_Site(pos1_X, pos1_Y - 140 + ColorPos2)								// 点击移动应用商场,取消选中Delay 1000//Call Move_To(pos3_X + 60, pos1_Y + 260 + ColorPos2 + 50)						// 选中移动应用商场后确定按钮位置向下移动50像素//Delay 13000//Call Move_To(pos1_X, pos1_Y + 260 + ColorPos2 + 50)//Delay 13000Call Click_Site(pos1_X, pos1_Y + 260 + ColorPos2 + 50)							// 点击确定按钮Delay 3000If_Color_Click_count = 0Call If_Color_Click(pos1_X, pos1_Y + 260 + ColorPos2 + 50, ClickColor_queding)	// 点击确定按钮Else //Call Move_To(pos3_X + 60, pos1_Y + 260)//Delay 13000//Call Move_To(pos1_X + 60, pos1_Y + 260)//Delay 13000Call Click_Site(pos1_X, pos1_Y + 260)											// 点击确定按钮Delay 3000If_Color_Click_count = 0Call If_Color_Click(pos1_X, pos1_Y + 260, ClickColor_queding)					// 点击确定按钮End IfColorPos2_flag = 0//str2 = left & ", " & top//MessageBox "前后坐标变动:" &str1 & "; " & str2NextCall Plugin.Msg.Tips("传包工具运行结束!" & vbcrlf & "共上传" & indexUp & "个程序包!")Delay 5000End IfEnd Sub// 选择需要上传的apk包 500, 805
Sub selectApk(path, apkName, index)Delay 1500//hwnd = Plugin.Window.Find("#32770", "打开")hwnd = Plugin.Window.Find("#32770", openApkTittle)//MessageBox "apk包选择界面句柄:" & hwndisfind = Plugin.Window.IsWindow(hwnd)If isfind = 0 Then // 若未找到KeyPress "PageUp", 10	// 翻页至最上方Delay 20KeyPress "PageUp", 10	// 翻页至最上方Delay 20//Call Move_To(pos3_X + 60, pos3_Y + 5)	// 移动至上传程序包//Delay 10000WaitforColor_Home = 1Call WaitForColor(pos3_X + 60, pos3_Y + 5, pos3_Color, "等待进入上传程序包界面", "上传程序包界面载入完成")// 等待上传程序包按钮,所在界面载入完成(界面载入完成,此坐标处颜色变为"E3950C")Call Move_To(pos3_X, pos3_Y)	// 移动至上传程序包Call Left_Click(1)				// 上传程序包//Call If_Color_Click(pos3_X + 60, pos3_Y + 5, pos3_Color)		// 点击上传程序包按钮WaitforColor_Home = 0Call Plugin.Msg.Tips("点击上传程序包!")Delay 20Call selectApk(path, apkName, index)Else If openDialogType = "2" Then Call selectFile2(path & "\" & apkName)	// 选中目录下的apk文件Else Call selectFile(path, index)			// 选中目录下的apk文件End IfEnd If
End Sub// 选择计费点逻辑
Sub ChargePoints()selectCharge = 1Call ActivateLoadPage()		// 激活窗口//MessageBox "ColorPos2=" & ColorPos2// 选中所有计费点Call SelectChargePoints(charges1, 1, ChargePoints_X, ChargePoints_Y1 + ColorPos2)Call SelectChargePoints(charges2, 2, ChargePoints_X, ChargePoints_Y2  + ColorPos2)Call SelectChargePoints(charges3, 3, ChargePoints_X, ChargePoints_Y3 + ColorPos2)Delay 100selectCharge = 0
End Sub// 分组计费点信息,将计费点中的信息按照ChargePoints_num2,ChargePoints_num1这两个索引值进行分组
Sub groupCharges()charges1 = ""charges2 = ""charges3 = ""TMP=Split(chargesAll,",")For Each A In TMP//For Each遍历数组B中的元素Aindex = CLng(A)//MessageBox "ChargePoints_num2=" & ChargePoints_num2 & "; " & "ChargePoints_num1=" & ChargePoints_num1If (index > ChargePoints_num2) Then 	// 相对于第3页的索引偏移值If charges3 = "" Then charges3 = "" & indexElse charges3 = charges3 & "," & indexEnd IfElseIf (index > ChargePoints_num1) Then	// 相对于第2页的索引偏移值If charges2 = "" Then charges2 = "" & indexElse charges2 = charges2 & "," & indexEnd IfElse If charges1 = "" Then charges1 = "" & indexElse charges1 = charges1 & "," & indexEnd IfEnd IfNext//MessageBox "charges1=[" & charges1 & "] " & "charges2=[" & charges2 & "] " & "charges3=[" & charges3 & "]"//EndScriptEnd Sub// 选择计费点points中的所有计费点
Sub SelectChargePoints(points, pageDon, left, top)If pageDon = 1 ThenKeyPress "Home", 1 			// 翻页至最上方Delay 1000End IfKeyPress "PageDown", 1			// 翻页至对应的计费点处Delay 1000TMP=Split(points,",")For Each A In TMP//For Each遍历数组B中的元素Aindex = CLng(A)If (index > ChargePoints_num2) Then 	// 相对于第3页的索引偏移值index = index - ChargePoints_num2ElseIf (index > ChargePoints_num1) Then	// 相对于第2页的索引偏移值index = index - ChargePoints_num1End IfCall Move_To(left, top + 2 + 33*index)	// 移动至移动至第index个计费点处Call Left_Click(1)						// 选中Delay 50NextEnd Sub// 若坐标处的颜色值为ClickColor,则不断点击坐标处
Sub If_Color_Click(left, top, ClickColor)// 若为给定的颜色值则不断点击C_click = GetPixelColor(left, top)Call Plugin.Msg.Tips("鼠标点击处,颜色值" & C_click)Delay 500Call Move_To(left, top)		// 移动至坐标处Call Left_Click(1)			// 点击Delay 30Call Move_To(left+600, top+2)// 改变鼠标位置If ClickColor = C_click Then Delay 3000If If_Color_Click_count < 20	//颜色值为指定值时,则重复调用20次点击If_Color_Click_count = If_Color_Click_count + 1Call If_Color_Click(left, top, ClickColor)Else If_Color_Click_count = 0End IfElse If_Color_Click_count = 0End IfEnd Sub// 等待坐标处的颜色变化为指定颜色值
Sub WaitForColor0(left, top, colorN, info1, info2)If WaitforColor_Home = 1 Then KeyPress "Home", 1 			// 翻页至最上方Delay 1000End IfIf AutoMoveToPoint_add = 1 Then Call Move_To(339, 645)		// 鼠标移动到该点坐标处,若添加程序包按钮处于该处会自动向上移动Delay 1000End Iftip = "F10启动, F11暂停, F12终止"C = GetPixelColor(left, top)If debugMode = 1 Then Call Move_To(left, top)	// 移动至上传上传完成颜色值获取处End IfIf colorN = C Then Call Plugin.Msg.Tips(info2 & vbcrlf & vbcrlf & vbcrlf & tip)ElseIf C = "FBFBFF" Then Call Plugin.Msg.Tips(info1 & "  Error: 操作异常,请手动完成该步后,按Space键继续!" & vbcrlf & vbcrlf & "颜色#" & C & vbcrlf & tip)KeyPress "Pause/Break", 1Delay 1400Call WaitForColor(left, top, colorN, info1, info2)ElseCall Plugin.Msg.Tips(info1 & vbcrlf & vbcrlf & "颜色#" & C & vbcrlf & tip)Delay 1400Call WaitForColor(left, top, colorN, info1, info2)End IfEnd Sub// 等待坐标处的颜色变化为指定颜色值
Sub WaitForColor(left, top, colorN, info1, info2)If WaitforColor_Home = 1 Then KeyPress "Home", 1 			// 翻页至最上方Delay 1000End IfIf AutoMoveToPoint_add = 1 Then Call Move_To(339, 645)		// 鼠标移动到该点坐标处,若添加程序包按钮处于该处会自动向上移动Delay 1000End Iftip = "F10启动, F11暂停, F12终止"C = GetPixelColor(left, top)If colorN = C Then ColorPos2 = 0Call Plugin.Msg.Tips(info2 & vbcrlf & vbcrlf & vbcrlf & tip)ElseIf C = "FBFBFF" Then Call Plugin.Msg.Tips(info1 & "  Error: 操作异常,请手动完成该步后,按Space键继续!" & vbcrlf & vbcrlf & "颜色#" & C & vbcrlf & tip)KeyPress "Pause/Break", 1Delay 1400Call WaitForColor(left, top, colorN, info1, info2)ElseIf ColorPos2_flag = 1 ThenColorPos2_Color = FindColorNear(left - 171, top + 37, colorN) // 在坐标附近寻找颜色colorNIf colorN = ColorPos2_Color Then ColorPos2 = 40		// 上传完成在坐标2处对界面布局颜色值位置偏移值Call Plugin.Msg.Tips("上传完成位置2,偏移值ColorPos2=" & ColorPos2)Delay 100Else Call Plugin.Msg.Tips(info1 & vbcrlf & vbcrlf & "颜色#" & C & vbcrlf & tip)Delay 1400Call WaitForColor(left, top, colorN, info1, info2)End If//Call Move_To(left - 171, top + 37)//Delay 10000Else Call Plugin.Msg.Tips(info1 & vbcrlf & vbcrlf & "颜色#" & C & vbcrlf & tip)Delay 1400Call WaitForColor(left, top, colorN, info1, info2)End IfEnd Sub// 用于实时获取浏览器窗体的在桌面上的坐标
Sub getClientRect()Delay 50Call Plugin.Window.Max(hwnd)	// 最大化显示rect = Plugin.Window.GetWindowRect(hwnd)//rect = Plugin.Window.GetClientRect(hwnd)rectArray=Split(rect,"|")Ux=CLng(rectArray(0))Uy = CLng(rectArray(1))//MessageBox "坐标:" & Ux & "," & Uy//MoveTo Ux, Uy
End Sub// 控制鼠标移动到浏览器上的指定坐标
Sub Move_To(x, y)If debugMode = 0 Then SaveMousePosEnd IfCall getClientRect()	// 获取浏览器坐标MoveTo (Ux + x), (Uy + y)Delay 100End Sub// 重定义左键单击
Sub Left_Click(n)If MouseLeft = "1" Then LeftClick nElse RightClick nEnd IfDelay 100If debugMode = 0  and selectCharge = 0 Then RestoreMousePosEnd If
End Sub// 重定义左键双击
Sub Left_DoubleClick(n)If MouseLeft = "1" Then LeftDoubleClick nElse RightClick 2 * nEnd IfDelay 100If debugMode = 0 Then RestoreMousePosEnd If
End Sub// 输入文本信息
Sub Say_String(str)SayString strDelay 800
End Sub// 在坐标位置控件中输入字符串
Sub Input_String(left, top, str)//call Move_To(left, top)	// 移动至坐标处//call Left_DoubleClick(1)	// 双击选中call Click_Site(left, top)	// 选中Delay 100call Say_String(str)		// 输入str
End Sub// 移动鼠标到坐标处,并点击
Sub Click_Site(left, top)Call Move_To(left, top)		// 移动至坐标处Call Left_Click(1)			// 点击
End Sub// 登录逻辑
Sub CheckLogin()hwnd = Plugin.Window.Find(0, loginPageTittle)//MessageBox "句柄:" & hwndisfind = Plugin.Window.IsWindow(hwnd)If isfind = 0 Then 	// 若未找到登录界面,则在浏览器中打开URL= "http://dev.10086.cn/cmdn/supesite/newdev.loginout.php"Call RunApp(URL)Call WaitForColor(130, 450, LoginWait_Color, "登录界面载入中", "登录界面载入完成")	// 等待界面载入完成(界面载入完成,此坐标处颜色变为"E3950C")Call CheckLogin()Else Call Move_To(130, 450)Call Left_Click(1)			// 点击//call Move_To(1306, 320)	// 移动至用户名处//Left_DoubleClick (1)		// 双击选中KeyPress "Tab", 1Delay 50Say_String("15956922771")	// 输入用户名//MoveR 0, 67				// 移动到密码输入栏//Left_DoubleClick (1)		// 双击选中KeyPress "Tab", 1Delay 50Say_String("LT147258369@") 	// 输入密码KeyPress "Tab", 1			// 切换至输入验证码Delay 50Call Plugin.Msg.Tips("请进入输入验证码,并登录")Delay 3000End IfEnd Sub// 判定 进入应用信息->传包界面
Sub CheckUpLoadPage()hwnd = Plugin.Window.Find(0, myAppPageTittle)//MessageBox "句柄:" & hwndisfind = Plugin.Window.IsWindow(hwnd)If isfind = 0 Then 	// 若未找到登录界面,则在浏览器中打开//URL= "D:\乐堂批量传包\其他\上传程序包界面.jpg"//Call RunApp(URL)//MessageBox "请登录进入“中国移动开发者社区 - 我的应用”传包界面!"Call Plugin.Msg.Tips("请进入“管理中心 -> 应用维护 -> ‘游戏’ -> 应用信息”界面!")Delay 1000Call CheckUpLoadPage()Else Call Plugin.Window.Max(hwnd)// 最大化传包界面Delay 100//WaitforColor_Home = 1AutoMoveToPoint_add = 1Call WaitForColor(pos2_X + 80, pos2_Y + 15, pos2_Color, "等待进入添加程序包界面", "添加程序包界面载入完成")	// 等待添加程序包按钮,所在界面载入完成(界面载入完成,此坐标处颜色变为"E3950C")//Call Move_To(pos2_X, pos2_Y)// 移动到添加程序包//Call Left_Click(1)			// 点击If_Color_Click_count = 0Call If_Color_Click(pos2_X + 80, pos2_Y + 15, pos2_Color)		// 点击添加程序包按钮WaitforColor_Home = 0		// 向上翻页置空AutoMoveToPoint_add = 0		// 移动至指定坐标点置空Delay 1000End IfEnd Sub// 判定 进入应用信息->传包界面
Sub ActivateLoadPage()hwnd = Plugin.Window.Find(0, "我的应用 - 中国移动开发者社区 - 360极速浏览器")//MessageBox "句柄:" & hwndisfind = Plugin.Window.IsWindow(hwnd)If isfind = 0 Then 				 	// 若未找到Call ActivateLoadPage()Else Call Plugin.Window.Max(hwnd)// 激活窗口Delay 200Call Move_To(972, 200)	// 移动至坐标处Call Left_Click(1)		// 点击Delay 200End IfDelay 100
End Sub // 检测apk包路径是否存在
Sub checkPath()// 包路径不存在时,根据配置文件名创建If (packagePath = "") Then configName = Split(configFile, "\")MessageBox configFiletmp_path_name = configName(UBound(configName))	// 获取配置文件名Delay 1000Call Plugin.Msg.Tips("截取文件名:" & tmp_path_name)packagePath = curDir & "\游戏包" & "\" & Replace(tmp_path_name, ".txt", "")Call Plugin.File.WriteINI(tittle, "apk包路径", packagePath, configFile)	// 记录到配置文件中End If// 在包路径下创建文件夹Set fso = CreateObject("Scripting.FileSystemObject")IsFile = fso.FolderExists(packagePath)If IsFile = 0 ThenCall Plugin.File.CreateFolder(packagePath)End IfDelay 500
End Sub// 在整个屏幕中寻找颜色值colorN的坐标,存储到intX, intY中
Sub ColorPos(colorN)width = Plugin.GetSysInfo.GetScreenResolutionX()	//获得屏幕分辨率宽度height = Plugin.GetSysInfo.GetScreenResolutionY()	//获得屏幕分辨率高度call FindColorInRect(0, 0, width, height, colorN, 1)
End Sub// 在指定的区域中寻找颜色值colorN的坐标,存储到intX, intY中
Sub FindColorInRect(left, top, width, height, colorN, stepN)x = 0intX = -1 intY = -1 While x < widthy = 0While y < heightC = GetPixelColor(left + x, top + y)If (colorN = C) Then intX = left + xintY = top + yx = widthy = heightEnd Ify=y+stepNWendx=x+stepNWendIf intX > 0 And intY > 0 Then Call Move_To(intX, intY)Call Plugin.Msg.Tips("在坐标(" & intX & "," & intY & ")处,找到颜色值" & colorN & "!")Else Call Plugin.Msg.Tips("未找到颜色值" & colorN & "对应的坐标!" & intX & "," & intY)End IfcolorPosX = intXcolorPosY = intYEnd Sub// 判断坐标附近是否存在颜色值
Function FindColorNear(near_L, near_T, near_color)Call FindColorInRect(near_L+10, near_T+10, 10, 10, near_color, 1)	// 在坐标附近寻找颜色colorNIf colorPosX > 0 And colorPosY > 0 Then FindColorNear = near_colorElse Call FindColorInRect(near_L-10, near_T-10, 10, 10, near_color, 1)	// 在坐标附近寻找颜色colorNIf colorPosX > 0 And colorPosY > 0 Then FindColorNear = near_colorElse FindColorNear = "FFFOOO"End IfEnd IfEnd Function// 选中路径path下的第index个文件
Sub selectFile(path, index)KeyPress "F4", 1			// 打开对话框地址栏Delay 20KeyPress "BackSpace", 30	// 删除默认地址信息Delay 30Call Say_String(path)		// 打开指定目录位置KeyPress "Enter", 1Delay 20// 选中第一个文件KeyPress "F6", 3Delay 20KeyPress "Down", 1Delay 20KeyPress "Up", 1Delay 20// 选中第index个文件If index > 1 Then KeyPress "Down", index-1Delay 20End If// Alt + OKeyDown 18, 1KeyPress 79, 1KeyUp 18, 1Delay 20End Sub// 选中文件pathName
Sub selectFile2(pathName)// apk文件完整路径Call Say_String(pathName)		//KeyPress "Enter", 1//Delay 20// Alt + SKeyDown 18, 1KeyPress 83, 1KeyUp 18, 1Delay 20End Sub// 选中签名文件pathName
Sub selectSignFile2(pathName)// apk文件完整路径Call Say_String(pathName)		//KeyPress "Enter", 1//Delay 20// Alt + OKeyDown 18, 1KeyPress 79, 1KeyUp 18, 1Delay 20End Sub// 获取路径下的文件数目
Function GetFilesNum(filePath)Dim filePathNumfilePathNum = 0Set F = CreateObject("Scripting.FileSystemObject")If Not F.FolderExists(filePath) ThenMsgBox "未检测到文件夹: " & filePath + "; 脚本已自动终止!"EndScriptEnd IfSet oF = F.GetFolder(filePath)For Each a In oF.Files//MessageBox "路径:"& configDir & "下,文件数目:" & num & " 文件名:" & a.NAME//MSGBOX a.NAMEfilePathNum = filePathNum + 1NextGetFilesNum = filePathNum//MsgBox "文件夹," & filePath + "下,文件数目:" & filePathNum & "; 脚本执行完成已自动终止!"//EndScriptEnd Function// 获取路径下的文件数目
Function GetFilesNames(filePath)Dim fileNamesTmpfilePathNum = 0Set F = CreateObject("Scripting.FileSystemObject")If Not F.FolderExists(filePath) ThenMsgBox "未检测到文件夹: " & filePath + "; 脚本已自动终止!"EndScriptEnd IfSet oF = F.GetFolder(filePath)For Each a In oF.FilesIf filePathNum = 0 ThenfileNamesTmp = a.NAMEElse fileNamesTmp = fileNamesTmp + ","  + a.NAMEEnd IffilePathNum = filePathNum + 1NextGetFilesNames = Split(fileNamesTmp, ",")//MsgBox "文件夹," & filePath + "下,文件:" & fileNamesTmp & "; 脚本执行完成已自动终止!"//EndScriptEnd Function// 上传签名文件 500,685
Sub UpLoadSign(pageDon, down, left, top)//Call ActivateLoadPage()			// 激活窗口Delay 100KeyPress "Home", 1 				// 翻页至最上方Delay 1000KeyPress "PageDown", pageDon	// 翻页至对应的计费点处Delay 1000KeyPress "Down", down			// 向下移动Delay 100Call Move_To(left, top)			// 选用自己的签名Call Left_Click(1)				// 选中Call SelectSign(left, top + 60)// 选择签名文件End Sub// 移动到坐标处,并输入签名信息
Sub Input_String1(I_left, I_top, mode)Call Move_To(I_left, I_top)		// 移动到坐标处Call Left_Click(1)				// 选中KeyPress "L", 1KeyPress "E", 1KeyPress "T", 1KeyPress "A", 1KeyPress "N", 1KeyPress "G", 1If mode = 1 ThenKeyPress "1", 1KeyPress "2", 1KeyPress "3", 1End IfDelay 200End Sub// 选中使用最近上传截图
Sub SelectRecentPics(leftRecentPic, topRecentPic)Call FindColorInRect(leftRecentPic-10, topRecentPic-10, 20, 20, "009AFF", 1)If colorPosX > 0 And colorPosY > 0 Then Call Click_Site(colorPosX - 10, colorPosY+3)Call Plugin.Msg.Tips("选中使用最近程序包截图!")Else Call Plugin.Msg.Tips("未选中使用最近程序包截图!")End IfDelay 50
End Sub// 选择上传签名文件
Sub SelectSign(left, top)Call Plugin.Msg.Tips("等待证书上传3秒 " & "(" & pageDon & "," & down & ")")Call Move_To(left, top)	// 选用自己的签名Call Left_Click(1)		// 选中Delay 100signDir = curDir & "\签名"If openDialogType = "2" Then signFile = GetFilesNames(signDir)		// 获取签名文件名Delay 1000Call selectSignFile2(signDir & "\" & signFile(0))Else Call selectFile(signDir & "\签名", 1)// 选中目录下的签名文件End IfDelay 2000//Call WaitForColor(left + 65, top + 5, Pos1_Color, "上传证书中...", "上传证书完成") // 等待上传程序包按钮,所在界面载入完成(界面载入完成,此坐标处颜色变为"E3950C")
End Sub// ===================================================================
// 配置参数信息的读写
// ===================================================================// 字符串型坐标(x,y)解析
Function Pos(StrPos)TMP_Pos = Split(StrPos, ",")Dim Array_pos(2)Array_pos(0) = CLng(TMP_Pos(0))Array_pos(1) = CLng(TMP_Pos(1))Pos = Array_pos
End Function// 字符串型坐标(x,y)解析
Function Pos4(StrPos)TMP_Pos = Split(StrPos, ",")Dim Array_pos(4)Array_pos(0) = CLng(TMP_Pos(0))Array_pos(1) = CLng(TMP_Pos(1))Array_pos(2) = CLng(TMP_Pos(2))Array_pos(3) = CLng(TMP_Pos(3))Pos4 = Array_pos
End Function// 向配置文件中写入配置信息
Sub WriteConfig()Call Plugin.File.WriteINI(tittle, "鼠标左右键设置", MouseLeft, configFile)Call Plugin.File.WriteINI(tittle, "自动输入用户名密码", autoLogin, configFile)Call Plugin.File.WriteINI(tittle, "登录界面进程名", loginPageTittle, configFile)Call Plugin.File.WriteINI(tittle, "我的应用界面进程名", myAppPageTittle, configFile)Call Plugin.File.WriteINI(tittle, "选择apk文件对话框标题", openApkTittle, configFile)Call Plugin.File.WriteINI(tittle, "选择apk文件对话框类型", openDialogType, configFile)Call Plugin.File.WriteINI(tittle, "登录界面提示颜色值", LoginWait_Color, configFile)Call Plugin.File.WriteINI(tittle, "添加程序包按钮坐标", pos2_X & "," &pos2_Y, configFile)Call Plugin.File.WriteINI(tittle, "添加程序包按钮颜色值", pos2_Color, configFile)Call Plugin.File.WriteINI(tittle, "上传程序包按钮坐标", pos3_X & "," &pos3_Y, configFile)Call Plugin.File.WriteINI(tittle, "上传程序包按钮颜色值", pos3_Color, configFile)Call Plugin.File.WriteINI(tittle, "apk包上传完成颜色值", apkFinishColor, configFile)Call Plugin.File.WriteINI(tittle, "计费点坐标x_y1_y2_y3", ChargePoints_X & "," & ChargePoints_Y1 & "," & ChargePoints_Y2 & "," & ChargePoints_Y3, configFile)Call Plugin.File.WriteINI(tittle, "计费点偏移值charge_n1_n2", ChargePoints_num1 & "," & ChargePoints_num2, configFile)Call Plugin.File.WriteINI(tittle, "证书签名坐标定位(PgDn,down)", SignPageDown & "," & SignDownArrow, configFile)Call Plugin.File.WriteINI(tittle, "证书签名坐标", pos1_X & "," &pos1_Y, configFile)Call Plugin.File.WriteINI(tittle, "证书上传完成颜色值", Pos1_Color, configFile)Call Plugin.File.WriteINI(tittle, "apk包路径", packagePath, configFile)//Call Plugin.File.WriteINI(tittle, "计费点1到21", charges1, configFile)//Call Plugin.File.WriteINI(tittle, "计费点22到45", charges2, configFile)//Call Plugin.File.WriteINI(tittle, "计费点46到以上", charges3, configFile)Call Plugin.File.WriteINI(tittle, "计费点", chargesAll, configFile)End Sub// 从配置文件中读取配置信息
Sub ReadConfig()MouseLeft = Plugin.File.ReadINI(tittle, "鼠标左右键设置", configFile)autoLogin = Plugin.File.ReadINI(tittle, "自动输入用户名密码", configFile)loginPageTittle = Plugin.File.ReadINI(tittle, "登录界面进程名", configFile)//MessageBox "登录界面进程名" & loadingPageTittle & ","myAppPageTittle = Plugin.File.ReadINI(tittle, "我的应用界面进程名", configFile)openApkTittle = Plugin.File.ReadINI(tittle, "选择apk文件对话框标题", configFile)openDialogType = Plugin.File.ReadINI(tittle, "选择apk文件对话框类型", configFile)LoginWait_Color = Plugin.File.ReadINI(tittle, "登录界面提示颜色值", configFile)pos2  = Pos(Plugin.File.ReadINI(tittle, "添加程序包按钮坐标", configFile))pos2_X = pos2(0)pos2_Y = pos2(1)pos2_Color = Plugin.File.ReadINI(tittle, "添加程序包按钮颜色值", configFile)pos3  = Pos(Plugin.File.ReadINI(tittle, "上传程序包按钮坐标", configFile))pos3_X = pos3(0)pos3_Y = pos3(1)pos3_Color = Plugin.File.ReadINI(tittle, "上传程序包按钮颜色值", configFile)apkFinishColor = Plugin.File.ReadINI(tittle, "apk包上传完成颜色值", configFile)x_y1_y2_y3  = Pos4(Plugin.File.ReadINI(tittle, "计费点坐标x_y1_y2_y3", configFile))ChargePoints_X = x_y1_y2_y3(0)ChargePoints_Y1 = x_y1_y2_y3(1)ChargePoints_Y2 = x_y1_y2_y3(2)ChargePoints_Y3 = x_y1_y2_y3(3)//MessageBox "ChargePoints_X="& ChargePoints_X & "; " & "ChargePoints_Y1="& ChargePoints_Y1 & "; " &  "ChargePoints_Y2="& ChargePoints_Y2 & "; " &  "ChargePoints_Y3="& ChargePoints_Y3//EndScriptcharge_n1_n2  = Pos(Plugin.File.ReadINI(tittle, "计费点偏移值charge_n1_n2", configFile))ChargePoints_num1 = charge_n1_n2(0)ChargePoints_num2 = charge_n1_n2(1)posSign  = Pos(Plugin.File.ReadINI(tittle, "证书签名坐标定位(PgDn,down)", configFile))SignPageDown = posSign(0)SignDownArrow = posSign(1)pos1  = Pos(Plugin.File.ReadINI(tittle, "证书签名坐标", configFile))pos1_X = pos1(0)pos1_Y = pos1(1)pos1_Color = Plugin.File.ReadINI(tittle, "证书上传完成颜色值", configFile)packagePath = Plugin.File.ReadINI(tittle, "apk包路径", configFile)//charges1 = Plugin.File.ReadINI(tittle, "计费点1到21", configFile)//charges2 = Plugin.File.ReadINI(tittle, "计费点22到45", configFile)//charges3 = Plugin.File.ReadINI(tittle, "计费点46到以上", configFile)chargesAll = Plugin.File.ReadINI(tittle, "计费点", configFile)Call groupCharges()			// 分组计费点信息到charges1、charges2、charges3中Call Plugin.Msg.Tips("配置信息载入完成")
End Sub// 选择配置文件
Sub SelectConfig()configDir = curDir & "\配置信息"num = GetFilesNum(configDir)//获取给定目录下的apk文件数目If num = 0 Then Call Plugin.Msg.Tips("路径:"& configDir & "下,没有配置文件,已自动生成默认配置示例!")Call WriteConfig()	// 没有配置文件时,生成默认前配置信息到文件End IfMessageBox "请在路径下选择配置信息!路径:"& configDirCall Plugin.Msg.Tips("请在路径下选择配置信息!路径:" & configDir)dim filepath    filepath=Plugin.File.SelectFile()//MessageBox "您所选择的文件是:" & filepathconfigFile = filepath	// 获取配置文件名If (configFile = "") Then MessageBox "您未选择路径" & configDir & "下的,任何配置信息! 脚本已停止运行。"EndScriptElse Call ReadConfig()// 从文件中读取配置信息End If
End Sub