所以这是我的第一个AHK课程,我对这门语言并不熟悉。我熟悉C#。我有以下`程序循环文件并拆分用管道(|)符号分割的用户名和密码。现在,当我运行程序时,它不会在文件结束后停止循环。
此外,我尝试使用StrSplit函数访问由管道符号分隔的用户名和密码。到目前为止,当我运行该程序时,用户名有时只能entered
正确进入浏览器。密码未输入浏览器。我很确定“我正在使用鼠标坐标。”
先谢谢你的帮助!
#SingleInstance, Force
SetWorkingDir, %A_ScriptDir% ; if an absolute path isn't specified
;; GUI input
;-------------------------------
; ---------------------------------------
Gui, Add, Button, x10 y20 gStart, Start the tool
Gui, Show, w300 h300, Steam Tool
return
; Labels
; -----------------------
; --------------------------------
Start:
Loop, read, accounts.txt ; the file name must be separated by a comma
{
; MsgBox %A_LoopReadLine%
loop, parse, A_LoopReadLine,
{
IfWinNotExist, Multiloginapp - 01.3.15
{
Run, C:\Program Files (x86)\Multiloginapp\multiloginapp.exe
WinWait, Multiloginapp - 01.3.15
Sleep, 20000
}
IfWinNotActive, Multiloginapp - 01.3.15, ,WinActivate, Multiloginapp - 01.3.15
WinWaitActive, Multiloginapp - 01.3.15
Click 724, 260
sleep, 1500
WinWait, Multiloginapp - Mozilla Firefox
WinActivate, Multiloginapp - Mozilla Firefox
WinWaitActive, Multiloginapp - Mozilla Firefox
Click 408, 55
Sleep 5000
Send, ^a
Send, {Backspace}
SendInput, store.steampowered.com/account ; SendInput is faster in sending text
Send, {enter}
Sleep, 5000
; Use:
; SendInput, %A_LoopField%
; if you want to send the current substring (field) from the line
s:=StrSplit(A_LoopReadLine, "|")
Click, 149, 355
urnme := s[0]
Send, %usrnme%
Click, 172 455
pwd := s[1]
Send, %pwd%
Click, 87 507
}
}
return
答案 0 :(得分:0)
以这种方式尝试:
#SingleInstance, Force
SetWorkingDir, %A_ScriptDir% ; if an absolute path isn't specified
;; GUI input
;-------------------------------
; ---------------------------------------
Gui, Add, Button, x10 y20 gStart, Start the tool
Gui, Show, w300 h300, Steam Tool
return
; Labels
; -----------------------
; --------------------------------
Start:
IfWinNotExist, Multiloginapp - 01.3.15
{
Run, C:\Program Files (x86)\Multiloginapp\multiloginapp.exe
WinWait, Multiloginapp - 01.3.15
Sleep, 20000
}
IfWinNotActive, Multiloginapp - 01.3.15, ,WinActivate, Multiloginapp - 01.3.15
WinWaitActive, Multiloginapp - 01.3.15
Click 724, 260
sleep, 1500
WinWait, Multiloginapp - Mozilla Firefox
WinActivate, Multiloginapp - Mozilla Firefox
WinWaitActive, Multiloginapp - Mozilla Firefox
Click 408, 55
Sleep 5000
Send, ^a
Send, {Backspace}
SendInput, store.steampowered.com/account ; SendInput is faster in sending text
Sleep, 300
Send, {enter}
Sleep, 5000
; If the title of the window changes after this, you should use:
; WinWait, new title
; WinActivate, new title
; WinWaitActive, new title
Click, 149, 355
; ... continue using one of the next options
; ...
return
第一个选项 - 直接发送用户名和密码(不读取文件):
SendInput, username
Sleep, 300
Click, 172, 455 ; or Send, {Tab} if it activates the password field
Sleep, 300
SendInput, password
Click, 87, 507 ; or Send, {enter} if it activates the log-in field
第二个选项 - 如果您必须从文件中读取用户名和密码:
FileReadLine, OutputVar, accounts.txt, 1 ; If username|password (without spaces) is the first line in this file
usrnme := StrSplit(OutputVar,"|").1
pwd := StrSplit(OutputVar,"|").2
SendInput, %usrnme%
Sleep, 300
Click, 172, 455 ; or Send, {Tab} if it activates the password field
Sleep, 300
SendInput, %pwd%
Sleep, 300
Click, 87, 507 ; or Send, {enter} if it activates the log-in field