// 获取当前路径
curDir = Plugin.Sys.GetDir(0)
//curDir = "D:\sci\按键精灵\乐堂批量传包"
curDir = Replace(curDir, "\配置信息", "")
Call Plugin.Msg.Tips("获得路径:" & curDir)
//MessageBox "获得路径:" & curDir
autoLogin = "1" // 标记是否自动登录
MouseLeft = "2" // 鼠标左右键设置
configFile = curDir & "\配置信息\熊出没2(默认配置).txt"
tittle = "配置信息"
loginPageTittle = "登录_中国移动开发者社区 - 360极速浏览器"
myAppPageTittle = "我的应用 - 中国移动开发者社区 - 360极速浏览器"
// 选择apk文件对话框配置
openApkTittle = "选择要上载的文件,通过: dev.10086.cn"
openDialogType = "2"
debugMode = 0
Dim hwnd // 定义句柄
Dim Ux, Uy // 浏览器坐标
Dim charges
Ux = - 1
Uy = -1
Dim colorPosX // 记录颜色值函数查找颜色后获取到的坐标
Dim colorPosY
LoginWait_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" Then
Call CheckLogin() // 登录逻辑
End If
Call checkPath() // 先检查apk路径是否存在,不存在则先创建
Call UpLoad(packagePath) // 批量上传程序包
End If
End Sub
// 上传path下所有apk包
Sub UpLoad(path)
indexUp = 0
Dim UpLoad_Num
UpLoad_Num = GetFilesNum(path)//获取给定目录下的apk文件数目
Call Plugin.Msg.Tips("文件夹" & path & "下" & vbcrlf & "程序包数目:" & UpLoad_Num)
Delay 3000
If UpLoad_Num = 0 Then
MessageBox "请先将apk包添加到目录:[" & path & "]中,再重新运行此脚本"
Else
names = GetFilesNames(path)
For UpLoad_Num
//str1 = left & ", " & top
apk_name = names(indexUp)
indexUp = indexUp + 1
Call Plugin.Msg.Tips("上传程序包:" & indexUp & "/" & UpLoad_Num & vbcrlf & vbcrlf & apk_name)
Delay 1000
Call CheckUpLoadPage() // 进入我的应用传包界面
Call selectApk(path, apk_name, indexUp) // 选择apk包
//Call Move_To(pos3_X + 100, pos3_Y + 22)
//Delay 20000
apkInfo1 = "apk包上传中" & vbcrlf & indexUp & "/" & UpLoad_Num & vbcrlf & apk_name
apkInfo2 = "apk包上传完成" & vbcrlf & indexUp & "/" & UpLoad_Num & vbcrlf & apk_name
ColorPos2_flag = 1 // 判定颜色位置2
Call WaitForColor(pos3_X + 100, pos3_Y + 22, apkFinishColor, apkInfo1 ,apkInfo2) // 等待apk包上传完成,相对于上传包按钮的坐标
Call ChargePoints() // 选择计费点
Delay 100
Call 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 100
If (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 13000
Call Click_Site(pos1_X, pos1_Y + 260 + ColorPos2 + 50) // 点击确定按钮
Delay 3000
If_Color_Click_count = 0
Call 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 13000
Call Click_Site(pos1_X, pos1_Y + 260) // 点击确定按钮
Delay 3000
If_Color_Click_count = 0
Call If_Color_Click(pos1_X, pos1_Y + 260, ClickColor_queding) // 点击确定按钮
End If
ColorPos2_flag = 0
//str2 = left & ", " & top
//MessageBox "前后坐标变动:" &str1 & "; " & str2
Next
Call Plugin.Msg.Tips("传包工具运行结束!" & vbcrlf & "共上传" & indexUp & "个程序包!")
Delay 5000
End If
End Sub
// 选择需要上传的apk包 500, 805
Sub selectApk(path, apkName, index)
Delay 1500
//hwnd = Plugin.Window.Find("#32770", "打开")
hwnd = Plugin.Window.Find("#32770", openApkTittle)
//MessageBox "apk包选择界面句柄:" & hwnd
isfind = Plugin.Window.IsWindow(hwnd)
If isfind = 0 Then // 若未找到
KeyPress "PageUp", 10 // 翻页至最上方
Delay 20
KeyPress "PageUp", 10 // 翻页至最上方
Delay 20
//Call Move_To(pos3_X + 60, pos3_Y + 5) // 移动至上传程序包
//Delay 10000
WaitforColor_Home = 1
Call 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 = 0
Call Plugin.Msg.Tips("点击上传程序包!")
Delay 20
Call selectApk(path, apkName, index)
Else
If openDialogType = "2" Then
Call selectFile2(path & "\" & apkName) // 选中目录下的apk文件
Else
Call selectFile(path, index) // 选中目录下的apk文件
End If
End If
End Sub
// 选择计费点逻辑
Sub ChargePoints()
selectCharge = 1
Call 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 100
selectCharge = 0
End Sub
// 分组计费点信息,将计费点中的信息按照ChargePoints_num2,ChargePoints_num1这两个索引值进行分组
Sub groupCharges()
charges1 = ""
charges2 = ""
charges3 = ""
TMP=Split(chargesAll,",")
For Each A In TMP//For Each遍历数组B中的元素A
index = CLng(A)
//MessageBox "ChargePoints_num2=" & ChargePoints_num2 & "; " & "ChargePoints_num1=" & ChargePoints_num1
If (index > ChargePoints_num2) Then // 相对于第3页的索引偏移值
If charges3 = "" Then
charges3 = "" & index
Else
charges3 = charges3 & "," & index
End If
ElseIf (index > ChargePoints_num1) Then // 相对于第2页的索引偏移值
If charges2 = "" Then
charges2 = "" & index
Else
charges2 = charges2 & "," & index
End If
Else
If charges1 = "" Then
charges1 = "" & index
Else
charges1 = charges1 & "," & index
End If
End If
Next
//MessageBox "charges1=[" & charges1 & "] " & "charges2=[" & charges2 & "] " & "charges3=[" & charges3 & "]"
//EndScript
End Sub
// 选择计费点points中的所有计费点
Sub SelectChargePoints(points, pageDon, left, top)
If pageDon = 1 Then
KeyPress "Home", 1 // 翻页至最上方
Delay 1000
End If
KeyPress "PageDown", 1 // 翻页至对应的计费点处
Delay 1000
TMP=Split(points,",")
For Each A In TMP//For Each遍历数组B中的元素A
index = CLng(A)
If (index > ChargePoints_num2) Then // 相对于第3页的索引偏移值
index = index - ChargePoints_num2
ElseIf (index > ChargePoints_num1) Then // 相对于第2页的索引偏移值
index = index - ChargePoints_num1
End If
Call Move_To(left, top + 2 + 33*index) // 移动至移动至第index个计费点处
Call Left_Click(1) // 选中
Delay 50
Next
End Sub
// 若坐标处的颜色值为ClickColor,则不断点击坐标处
Sub If_Color_Click(left, top, ClickColor)
// 若为给定的颜色值则不断点击
C_click = GetPixelColor(left, top)
Call Plugin.Msg.Tips("鼠标点击处,颜色值" & C_click)
Delay 500
Call Move_To(left, top) // 移动至坐标处
Call Left_Click(1) // 点击
Delay 30
Call Move_To(left+600, top+2)// 改变鼠标位置
If ClickColor = C_click Then
Delay 3000
If If_Color_Click_count < 20 //颜色值为指定值时,则重复调用20次点击
If_Color_Click_count = If_Color_Click_count + 1
Call If_Color_Click(left, top, ClickColor)
Else
If_Color_Click_count = 0
End If
Else
If_Color_Click_count = 0
End If
End Sub
// 等待坐标处的颜色变化为指定颜色值
Sub WaitForColor0(left, top, colorN, info1, info2)
If WaitforColor_Home = 1 Then
KeyPress "Home", 1 // 翻页至最上方
Delay 1000
End If
If AutoMoveToPoint_add = 1 Then
Call Move_To(339, 645) // 鼠标移动到该点坐标处,若添加程序包按钮处于该处会自动向上移动
Delay 1000
End If
tip = "F10启动, F11暂停, F12终止"
C = GetPixelColor(left, top)
If debugMode = 1 Then
Call Move_To(left, top) // 移动至上传上传完成颜色值获取处
End If
If 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", 1
Delay 1400
Call WaitForColor(left, top, colorN, info1, info2)
Else
Call Plugin.Msg.Tips(info1 & vbcrlf & vbcrlf & "颜色#" & C & vbcrlf & tip)
Delay 1400
Call WaitForColor(left, top, colorN, info1, info2)
End If
End Sub
// 等待坐标处的颜色变化为指定颜色值
Sub WaitForColor(left, top, colorN, info1, info2)
If WaitforColor_Home = 1 Then
KeyPress "Home", 1 // 翻页至最上方
Delay 1000
End If
If AutoMoveToPoint_add = 1 Then
Call Move_To(339, 645) // 鼠标移动到该点坐标处,若添加程序包按钮处于该处会自动向上移动
Delay 1000
End If
tip = "F10启动, F11暂停, F12终止"
C = GetPixelColor(left, top)
If colorN = C Then
ColorPos2 = 0
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", 1
Delay 1400
Call WaitForColor(left, top, colorN, info1, info2)
ElseIf ColorPos2_flag = 1 Then
ColorPos2_Color = FindColorNear(left - 171, top + 37, colorN) // 在坐标附近寻找颜色colorN
If colorN = ColorPos2_Color Then
ColorPos2 = 40 // 上传完成在坐标2处对界面布局颜色值位置偏移值
Call Plugin.Msg.Tips("上传完成位置2,偏移值ColorPos2=" & ColorPos2)
Delay 100
Else
Call Plugin.Msg.Tips(info1 & vbcrlf & vbcrlf & "颜色#" & C & vbcrlf & tip)
Delay 1400
Call WaitForColor(left, top, colorN, info1, info2)
End If
//Call Move_To(left - 171, top + 37)
//Delay 10000
Else
Call Plugin.Msg.Tips(info1 & vbcrlf & vbcrlf & "颜色#" & C & vbcrlf & tip)
Delay 1400
Call WaitForColor(left, top, colorN, info1, info2)
End If
End Sub
// 用于实时获取浏览器窗体的在桌面上的坐标
Sub getClientRect()
Delay 50
Call 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
SaveMousePos
End If
Call getClientRect() // 获取浏览器坐标
MoveTo (Ux + x), (Uy + y)
Delay 100
End Sub
// 重定义左键单击
Sub Left_Click(n)
If MouseLeft = "1" Then
LeftClick n
Else
RightClick n
End If
Delay 100
If debugMode = 0 and selectCharge = 0 Then
RestoreMousePos
End If
End Sub
// 重定义左键双击
Sub Left_DoubleClick(n)
If MouseLeft = "1" Then
LeftDoubleClick n
Else
RightClick 2 * n
End If
Delay 100
If debugMode = 0 Then
RestoreMousePos
End If
End Sub
// 输入文本信息
Sub Say_String(str)
SayString str
Delay 800
End Sub
// 在坐标位置控件中输入字符串
Sub Input_String(left, top, str)
//call Move_To(left, top) // 移动至坐标处
//call Left_DoubleClick(1) // 双击选中
call Click_Site(left, top) // 选中
Delay 100
call 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 "句柄:" & hwnd
isfind = 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", 1
Delay 50
Say_String("15956922771") // 输入用户名
//MoveR 0, 67 // 移动到密码输入栏
//Left_DoubleClick (1) // 双击选中
KeyPress "Tab", 1
Delay 50
Say_String("LT147258369@") // 输入密码
KeyPress "Tab", 1 // 切换至输入验证码
Delay 50
Call Plugin.Msg.Tips("请进入输入验证码,并登录")
Delay 3000
End If
End Sub
// 判定 进入应用信息->传包界面
Sub CheckUpLoadPage()
hwnd = Plugin.Window.Find(0, myAppPageTittle)
//MessageBox "句柄:" & hwnd
isfind = Plugin.Window.IsWindow(hwnd)
If isfind = 0 Then // 若未找到登录界面,则在浏览器中打开
//URL= "D:\乐堂批量传包\其他\上传程序包界面.jpg"
//Call RunApp(URL)
//MessageBox "请登录进入“中国移动开发者社区 - 我的应用”传包界面!"
Call Plugin.Msg.Tips("请进入“管理中心 -> 应用维护 -> ‘游戏’ -> 应用信息”界面!")
Delay 1000
Call CheckUpLoadPage()
Else
Call Plugin.Window.Max(hwnd)// 最大化传包界面
Delay 100
//WaitforColor_Home = 1
AutoMoveToPoint_add = 1
Call 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 = 0
Call If_Color_Click(pos2_X + 80, pos2_Y + 15, pos2_Color) // 点击添加程序包按钮
WaitforColor_Home = 0 // 向上翻页置空
AutoMoveToPoint_add = 0 // 移动至指定坐标点置空
Delay 1000
End If
End Sub
// 判定 进入应用信息->传包界面
Sub ActivateLoadPage()
hwnd = Plugin.Window.Find(0, "我的应用 - 中国移动开发者社区 - 360极速浏览器")
//MessageBox "句柄:" & hwnd
isfind = Plugin.Window.IsWindow(hwnd)
If isfind = 0 Then // 若未找到
Call ActivateLoadPage()
Else
Call Plugin.Window.Max(hwnd)// 激活窗口
Delay 200
Call Move_To(972, 200) // 移动至坐标处
Call Left_Click(1) // 点击
Delay 200
End If
Delay 100
End Sub
// 检测apk包路径是否存在
Sub checkPath()
// 包路径不存在时,根据配置文件名创建
If (packagePath = "") Then
configName = Split(configFile, "\")
MessageBox configFile
tmp_path_name = configName(UBound(configName)) // 获取配置文件名
Delay 1000
Call 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 Then
Call Plugin.File.CreateFolder(packagePath)
End If
Delay 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 = 0
intX = -1
intY = -1
While x < width
y = 0
While y < height
C = GetPixelColor(left + x, top + y)
If (colorN = C) Then
intX = left + x
intY = top + y
x = width
y = height
End If
y=y+stepN
Wend
x=x+stepN
Wend
If 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 If
colorPosX = intX
colorPosY = intY
End Sub
// 判断坐标附近是否存在颜色值
Function FindColorNear(near_L, near_T, near_color)
Call FindColorInRect(near_L+10, near_T+10, 10, 10, near_color, 1) // 在坐标附近寻找颜色colorN
If colorPosX > 0 And colorPosY > 0 Then
FindColorNear = near_color
Else
Call FindColorInRect(near_L-10, near_T-10, 10, 10, near_color, 1) // 在坐标附近寻找颜色colorN
If colorPosX > 0 And colorPosY > 0 Then
FindColorNear = near_color
Else
FindColorNear = "FFFOOO"
End If
End If
End Function
// 选中路径path下的第index个文件
Sub selectFile(path, index)
KeyPress "F4", 1 // 打开对话框地址栏
Delay 20
KeyPress "BackSpace", 30 // 删除默认地址信息
Delay 30
Call Say_String(path) // 打开指定目录位置
KeyPress "Enter", 1
Delay 20
// 选中第一个文件
KeyPress "F6", 3
Delay 20
KeyPress "Down", 1
Delay 20
KeyPress "Up", 1
Delay 20
// 选中第index个文件
If index > 1 Then
KeyPress "Down", index-1
Delay 20
End If
// Alt + O
KeyDown 18, 1
KeyPress 79, 1
KeyUp 18, 1
Delay 20
End Sub
// 选中文件pathName
Sub selectFile2(pathName)
// apk文件完整路径
Call Say_String(pathName)
//KeyPress "Enter", 1
//Delay 20
// Alt + S
KeyDown 18, 1
KeyPress 83, 1
KeyUp 18, 1
Delay 20
End Sub
// 选中签名文件pathName
Sub selectSignFile2(pathName)
// apk文件完整路径
Call Say_String(pathName)
//KeyPress "Enter", 1
//Delay 20
// Alt + O
KeyDown 18, 1
KeyPress 79, 1
KeyUp 18, 1
Delay 20
End Sub
// 获取路径下的文件数目
Function GetFilesNum(filePath)
Dim filePathNum
filePathNum = 0
Set F = CreateObject("Scripting.FileSystemObject")
If Not F.FolderExists(filePath) Then
MsgBox "未检测到文件夹: " & filePath + "; 脚本已自动终止!"
EndScript
End If
Set oF = F.GetFolder(filePath)
For Each a In oF.Files
//MessageBox "路径:"& configDir & "下,文件数目:" & num & " 文件名:" & a.NAME
//MSGBOX a.NAME
filePathNum = filePathNum + 1
Next
GetFilesNum = filePathNum
//MsgBox "文件夹," & filePath + "下,文件数目:" & filePathNum & "; 脚本执行完成已自动终止!"
//EndScript
End Function
// 获取路径下的文件数目
Function GetFilesNames(filePath)
Dim fileNamesTmp
filePathNum = 0
Set F = CreateObject("Scripting.FileSystemObject")
If Not F.FolderExists(filePath) Then
MsgBox "未检测到文件夹: " & filePath + "; 脚本已自动终止!"
EndScript
End If
Set oF = F.GetFolder(filePath)
For Each a In oF.Files
If filePathNum = 0 Then
fileNamesTmp = a.NAME
Else
fileNamesTmp = fileNamesTmp + "," + a.NAME
End If
filePathNum = filePathNum + 1
Next
GetFilesNames = Split(fileNamesTmp, ",")
//MsgBox "文件夹," & filePath + "下,文件:" & fileNamesTmp & "; 脚本执行完成已自动终止!"
//EndScript
End Function
// 上传签名文件 500,685
Sub UpLoadSign(pageDon, down, left, top)
//Call ActivateLoadPage() // 激活窗口
Delay 100
KeyPress "Home", 1 // 翻页至最上方
Delay 1000
KeyPress "PageDown", pageDon // 翻页至对应的计费点处
Delay 1000
KeyPress "Down", down // 向下移动
Delay 100
Call 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", 1
KeyPress "E", 1
KeyPress "T", 1
KeyPress "A", 1
KeyPress "N", 1
KeyPress "G", 1
If mode = 1 Then
KeyPress "1", 1
KeyPress "2", 1
KeyPress "3", 1
End If
Delay 200
End 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 If
Delay 50
End Sub
// 选择上传签名文件
Sub SelectSign(left, top)
Call Plugin.Msg.Tips("等待证书上传3秒 " & "(" & pageDon & "," & down & ")")
Call Move_To(left, top) // 选用自己的签名
Call Left_Click(1) // 选中
Delay 100
signDir = curDir & "\签名"
If openDialogType = "2" Then
signFile = GetFilesNames(signDir) // 获取签名文件名
Delay 1000
Call selectSignFile2(signDir & "\" & signFile(0))
Else
Call selectFile(signDir & "\签名", 1)// 选中目录下的签名文件
End If
Delay 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
//EndScript
charge_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 If
MessageBox "请在路径下选择配置信息!路径:"& configDir
Call Plugin.Msg.Tips("请在路径下选择配置信息!路径:" & configDir)
dim filepath
filepath=Plugin.File.SelectFile()
//MessageBox "您所选择的文件是:" & filepath
configFile = filepath // 获取配置文件名
If (configFile = "") Then
MessageBox "您未选择路径" & configDir & "下的,任何配置信息! 脚本已停止运行。"
EndScript
Else
Call ReadConfig()// 从文件中读取配置信息
End If
End Sub