如何使用VBS脚本给在直播间授权登陆

直接上代码,看不懂说明你技术不够

set WshShell=WScript.CreateObject("WScript.Shell")
Dim ie
Set mouse=New SetMouse
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "http://m.yy.com/live/anch/anchorRandomURL?f=6308"
Wscript.sleep
'ie.document.getElementsByClassName("login-btn")(0).click
ie.document.getElementsByClassName("s1")().click
Wscript.sleep
ie.document.getElementsByClassName("wblogin")().click
Wscript.sleep
'for i = 0 to 6
'WshShell.SendKeys "{Tab}"
'Wscript.sleep 2000
'next
mouse.move , '把鼠标移动到坐标
WScript.Sleep
mouse.clik "LEFT" '左击
WshShell.SendKeys "+"
Wscript.sleep
WshShell.SendKeys "liaoqiao02278@163.com"
Wscript.sleep
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "5ct90f"
Wscript.sleep
'*********************************************************************** ' 将鼠标移到验证码 '***********************************************************************
mouse.move , '把鼠标移动到坐标
WScript.Sleep
mouse.clik "RIGHT" '右击
WScript.Sleep
WshShell.SendKeys "S"
WScript.Sleep
WshShell.SendKeys "temp"
WScript.Sleep
WshShell.SendKeys "{Enter}"
WScript.Sleep
WshShell.SendKeys "{LEFT}"
WScript.Sleep
WshShell.SendKeys "{Enter}"
WScript.Sleep
Set exeRs = WshShell.Exec("curl.exe -F ""image=@C:\Users\HugeTech7\Pictures\temp.png"" ""http://api.ysdm.net/create.json?username=hq20150618&password=huge247247&typeid=3050&softid=52084&softkey=45b6a56f262a46f38d086c4f50826631""")
Wscript.sleep
errMsg = exeRs.StdErr.ReadAll()
stdMsg = exeRs.StdOut.ReadAll()
identify = Mid(stdMsg,,)
WScript.Sleep
mouse.move , '把鼠标移动到坐标
WScript.Sleep
mouse.clik "LEFT" '左击
WshShell.SendKeys identify
Wscript.sleep
WshShell.SendKeys "{Enter}"
Wscript.sleep
mouse.move , '把鼠标移动到坐标
WScript.Sleep
mouse.clik "LEFT" '左击
'*****************将以下代码加入到vbs文件末就能如以上方法调用******************************************************************************************* '**************************************************************************************************************************************************** Class SetMouse
private S
private xls, wbk, module1
private reg_key, xls_code, x, y Private Sub Class_Initialize()
Set xls = CreateObject("Excel.Application")
Set S = CreateObject("wscript.Shell")
'vbs 完全控制excel
reg_key = "HKEY_CURRENT_USER\Software\Microsoft\Office\$\Excel\Security\AccessVBOM"
reg_key = Replace(reg_key, "$", xls.Version)
S.RegWrite reg_key, , "REG_DWORD"
'model 代码
xls_code = _
"Private Type POINTAPI : X As Long : Y As Long : End Type" & vbCrLf & _
"Private Declare Function SetCursorPos Lib ""user32"" (ByVal x As Long, ByVal y As Long) As Long" & vbCrLf & _
"Private Declare Function GetCursorPos Lib ""user32"" (lpPoint As POINTAPI) As Long" & vbCrLf & _
"Private Declare Sub mouse_event Lib ""user32"" Alias ""mouse_event"" " _
& "(ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)" & vbCrLf & _
"Public Function getx() As Long" & vbCrLf & _
"Dim pt As POINTAPI : GetCursorPos pt : getx = pt.X" & vbCrLf & _
"End Function" & vbCrLf & _
"Public Function gety() As Long" & vbCrLf & _
"Dim pt As POINTAPI: GetCursorPos pt : gety = pt.Y" & vbCrLf & _
"End Function"
Set wbk = xls.Workbooks.Add
Set module1 = wbk.VBProject.VBComponents.Add()
module1.CodeModule.AddFromString xls_code
End Sub '关闭
Private Sub Class_Terminate
xls.DisplayAlerts = False
wbk.Close
xls.Quit
End Sub '可调用过程 Public Sub getpos( x, y)
x = xls.Run("getx")
y = xls.Run("gety")
End Sub Public Sub move(x,y)
xls.Run "SetCursorPos", x, y
End Sub Public Sub clik(keydown)
Select Case UCase(keydown)
Case "LEFT"
xls.Run "mouse_event", &H2 + &H4, , , ,
Case "RIGHT"
xls.Run "mouse_event", &H8 + &H10, , , ,
Case "MIDDLE"
xls.Run "mouse_event", &H20 + &H40, , , ,
Case "DBCLICK"
xls.Run "mouse_event", &H2 + &H4, , , ,
xls.Run "mouse_event", &H2 + &H4, , , ,
End Select
End Sub End Class '*********************************************************************** '代码结束 '***********************************************************************
上一篇:Storm学习笔记六


下一篇:Docker-创建一个mysql容器,并保存为本地镜像