2017-04-06 15 views
0

これは私の最初のAHKプログラムです。私はC#に精通しています。私はファイルをループし、パイプ(|)記号で分割されたユーザー名とパスワードを分割する次の `プログラムを持っています。今は私がプログラムを実行すると、ファイルの最後の後にループを止めることはありません。AutoHotKey - ファイルのループが終了し、ファイルの終了後に停止します。変数を送信しません。

さらに、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

LあなたがLoopを使っているような私にはおっとり、Parse wrong。私はループ、パース、A_LoopReadLine、CSVを試してみたいと思います。あなたのファイルはカンマ区切りです。 – errorseven

答えて

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 
関連する問題