Skip to content

Instantly share code, notes, and snippets.

@caiguanhao
Created June 12, 2014 03:27
Show Gist options
  • Save caiguanhao/220c9f1b61a927e73f64 to your computer and use it in GitHub Desktop.
Save caiguanhao/220c9f1b61a927e73f64 to your computer and use it in GitHub Desktop.
一键云赚送电费
; --------------------------------------------------------------
; Copyright (c) 2014 Cai Guanhao (Choi Goon-ho)
; Licensed under the terms of the MIT license.
; --------------------------------------------------------------
#Include <GuiToolBar.au3>
#Include "SysTray.au3"
Local $installer = "C:\bats\yzsetup.exe"
Local $program = _ProgramFilesDir() & "\BookSir\QiaoJin\BookSir.IM.Client.exe"
Local $title = "敲金 1.0.5102.22162 "
Local $username = "lhjaidww"
Local $userid = "335872084"
Local $userpass = ""
If Not FileExists($program) Then
If Not FileExists($installer) Then
Local $dl = InetGet("http://d.cgh.io/bats/yzsetup.exe", $installer, 1, 1)
Do
Local $info = InetGetInfo($dl)
If $info[0] > 0 Then
TrayTip("Downloading...", Round($info[0] / $info[1] * 100, 2) & "% completed.", 10, 1)
EndIf
Sleep(250)
Until InetGetInfo($dl, 2)
TrayTip("OK!", "Installer downloaded.", 10, 1)
EndIf
Run($installer)
Local $setupwin = WinWaitActive("敲金安装向导", "安装向导即将安装敲金到您的电脑上。")
Local $nextbtn = "[NAME:btnNext]"
Local $loop = 0
While ControlCommand($setupwin, "", $nextbtn, "IsEnabled") = 0
If $loop > 50 Then
Exit
EndIf
$loop = $loop + 1
Sleep(500)
Wend
ControlClick($setupwin, "", $nextbtn)
Sleep(500)
Local $setupwin = WinWaitActive("敲金安装向导", "程序将被安装到以下位置。")
ControlClick($setupwin, "", $nextbtn)
Sleep(500)
Local $setupwin = WinWaitActive("敲金安装向导", "安装程序已经完成在这台电脑上的敲金配置。")
ControlClick($setupwin, "", "[NAME:btnFinish]")
Sleep(500)
EndIf
If Not ProcessExists("BookSir.IM.Client.exe") Then
Run($program)
$win = WinWaitActive("[REGEXPCLASS:(?i)HwndWrapper.*Booksir.*]", "")
WinActivate($win)
Send("{TAB}^a" & $userid)
Sleep(500)
$win = WinWaitActive("[REGEXPCLASS:(?i)HwndWrapper.*Booksir.*]", "")
WinActivate($win)
Send("{TAB}^a" & $userpass)
Sleep(500)
$win = WinWaitActive("[REGEXPCLASS:(?i)HwndWrapper.*Booksir.*]", "")
WinActivate($win)
Send("{ENTER}")
Sleep(500)
Else
_SysTray_ClickItem($username, "left", 2)
EndIf
$win = WinWaitActive($title, "")
$pos = WinGetPos($win)
If @error = 0 Then
MouseClick("left", $pos[0] + 268, $pos[1] + 128, 1, 0)
EndIf
$win = WinWaitActive($title, "")
$pos = WinGetPos($win)
If @error = 0 Then
MouseClick("left", $pos[0] + 248, $pos[1] + 248, 1, 0)
EndIf
$info = WinWaitActive("", "客户端已经启动,无需重复启动。", 10)
ControlClick($info, "", "[CLASS:Button; INSTANCE:1]")
Sleep(1000)
$win = WinWaitActive($title, "")
$pos = WinGetPos($win)
If @error = 0 Then
MouseClick("left", $pos[0] + 240, $pos[1] + 16, 1, 0)
EndIf
Sleep(1000)
_SysTray_ClickItem("今天我赚了", "right", 1)
Sleep(500)
Send("{DOWN}{DOWN}{ENTER}")
$settings = WinWaitActive("客户端配置", "", 10)
If $settings Then
Send("{RIGHT}{RIGHT}")
Sleep(200)
Send("{TAB}{TAB}{TAB}")
Sleep(200)
Send("{SPACE}")
EndIf
Func _ProgramFilesDir()
Local $ProgramFileDir
Switch @OSArch
Case "X86"
$ProgramFileDir = "Program Files"
Case "X64"
$ProgramFileDir = "Program Files (x86)"
EndSwitch
Return @HomeDrive & "\" & $ProgramFileDir
EndFunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment