|
本帖最后由 lion.lee 于 2010-7-4 21:53 编辑
小菜在做一个自己用的QQ自动登录器,在往配置ini文件里添加了QQ执行路径后,iniread账号信息时返回了默认值。之前没有修改路径时工作正常,不知道为什么!
[代码如下]
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$userdaidai = IniRead("QQ账号配置.ini", "config", "daidai", "Input")
$userwangfei = IniRead("QQ账号配置.ini", "config", "wangfei", "Input")
If $userdaidai = $userwangfei Then
MsgBox(64, "通知", "账号没有读取到,下面将自动生成配置文件!", 1)
$userdaidai = InputBox("账号配置", "请输入daidai的QQ号", "00000000")
If @error = 1 Then Exit
$passworddaidai = InputBox("账号配置", "请输入daidai的密码", "00000000", "*")
If @error = 1 Then Exit
$userwangfei = InputBox("账号配置", "请输入wangfei的QQ号", "00000000")
If @error = 1 Then Exit
$passwordwangfei = InputBox("账号配置", "请输入wangfei的密码", "00000000", "*")
If @error = 1 Then Exit
IniWrite("QQ账号配置.ini", "config", "daidai", $userdaidai)
IniWrite("QQ账号配置.ini", "config", "wangfei", $userwangfei)
IniWrite("QQ账号配置.ini", "config", "passworddaidai", $passworddaidai)
IniWrite("QQ账号配置.ini", "config", "passwordwangfei", $passwordwangfei)
Sleep(1000)
MsgBox(64, "通知", "配置文件已经自动生成!", 1)
EndIf
$file = FileExists("d:\Program Files\Tencent\QQ\Bin\QQ.exe");;;;;就是这里,假如使用C盘默认路径的话,可以顺利执行!
If $file = 0 Then
MsgBox(64,"错误","你的QQ没有安装在默认路径,请重新选择QQ路径",1)
$lujing = FileOpenDialog("请选择QQ的运行路径", "C:\Program Files\Tencent\QQ\Bin" & "\", "QQ(QQ.exe)", 1)
If @error Then
MsgBox(64, "错误", "没有选择文件,程序将退出!",1)
Exit
Else
IniWrite(@ScriptDir & "\QQ账号配置.ini", "config", "QQ路径",$lujing);;;;;;再次往Ini文件里增加了QQ路径
EndIf
EndIf
$Form1 = GUICreate("QQ自动登录账号选择", 359, 131, 192, 114)
GUISetFont(24, 400, 0, "MS Sans Serif")
GUISetBkColor(0x0A246A)
$Button1 = GUICtrlCreateButton("daidai ", 8, 64, 121, 49)
$Button2 = GUICtrlCreateButton("wangfei", 216, 64, 121, 49)
$Label1 = GUICtrlCreateLabel("请选择需要登录的账号:", 8, 8, 334, 41)
GUICtrlSetBkColor(-1, 0x00FF00)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$lujing = IniRead("QQ账号配置.ini", "config", "QQ路径","error");;;;;;;;;;读取QQ路径正常
$userdaidai = IniRead("QQ账号配置.ini", "config", "daidai", "Input");;;;;;;;;;;不知道为什么返回值为默认的“Input”
$userwangfei = IniRead("QQ账号配置.ini", "config", "wangfei", "Input")
$passworddaidai = IniRead("QQ账号配置.ini", "config", "passworddaidai", "Input")
$passwordwangfei = IniRead("QQ账号配置.ini", "config", "passwordwangfei", "Input")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_daidai()
Case $Button2
_wangfei()
EndSwitch
WEnd
Func _daidai()
ShellExecute($lujing)
WinWaitActive("QQ2009", "")
ControlSetText("QQ2009", "", "ATL:30A4E1D81", $userdaidai)
Sleep(500)
ControlSetText("QQ2009", "", "Edit1", $passworddaidai)
Send("{tab}{enter}{down 6}{enter}")
Send("{tab 4}{enter}")
EndFunc ;==>_daidai
Func _wangfei()
ShellExecute($lujing)
WinWaitActive("QQ2009", "")
ControlSetText("QQ2009", "", "ATL:30A4E1D81", $userwangfei)
Sleep(500)
ControlSetText("QQ2009", "", "Edit1", $passwordwangfei)
Send("{tab}{enter}{down 6}{enter}")
Send("{tab 4}{enter}")
EndFunc ;==>_wangfei |
评分
-
查看全部评分
|