Autohotkey 自动热键-在文件dosen';文件结束后不停止,发送不发送变量
这是我的第一个AHK程序,我对语言一点也不熟悉。不过我对C#很熟悉。我有一个程序,它在一个文件中循环,并用管道(|)符号分割用户名和密码。现在,当我运行程序时,它不会在文件结束后停止循环 此外,我尝试使用StrSplit函数访问由管道符号分隔的用户名和密码。到目前为止,当我运行该程序时,用户名只是偶尔在浏览器中正确输入Autohotkey 自动热键-在文件dosen';文件结束后不停止,发送不发送变量,autohotkey,Autohotkey,这是我的第一个AHK程序,我对语言一点也不熟悉。不过我对C#很熟悉。我有一个程序,它在一个文件中循环,并用管道(|)符号分割用户名和密码。现在,当我运行程序时,它不会在文件结束后停止循环 此外,我尝试使用StrSplit函数访问由管道符号分隔的用户名和密码。到目前为止,当我运行该程序时,用户名只是偶尔在浏览器中正确输入。未在浏览器中输入密码。我很确定我使用的是鼠标右键坐标 提前谢谢你的帮助 #SingleInstance, Force SetWorkingDir, %A_ScriptDir% ;
。未在浏览器中输入密码。我很确定我使用的是鼠标右键坐标
提前谢谢你的帮助
#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
试着这样做:
#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
第一个选项-直接发送用户名和密码(不读取文件):
第二个选项-如果必须从文件中读取用户名和密码:
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
在我看来,您使用的是循环,解析错误。我会尝试循环,解析,一个_LoopReadLine,CSV,因为你提到你的文件是逗号分隔的。
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