AutoHotKey - 按照文档获取`文件循环

时间:2017-04-05 20:37:40

标签: autohotkey

我正在AHK制作一个程序,从商店网站中提取Steam价格和比特币地址。我将所有帐户存储在与脚本相同的目录中的文本文件中。

现在当我运行程序时,单击开始按钮时没有任何反应,没有任何反应。之前我曾尝试使用循环的函数并逐行读取文件,但这也无效。

我做错了什么? 这是我的代码。我是AHK的新手。我按照文档here中的示例进行操作,但我不确定它为什么不起作用。请帮忙!

#SingleInstance, Force

;; GUI input
: -------------------------------
: ---------------------------------------
Gui, Show, w300 h300, Steam Tool    
Gui, Add, Button, x10 y20 gStart, Start the tool
return

; Labels
; -----------------------
; --------------------------------

Start:    
Loop, read accounts,.txt
{
    loop, parse, LoopReadLine, %A_Tab%
    {                
        Run, C:\Program Files (x86)\Multiloginapp\multiloginapp.exe
        WinWait, Multiloginapp - 01.3.15
        Sleep, 20000
        WinActivate, Multiloginapp - 01.3.15
        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
        Click 408 55
        Sleep 5000
        Send, ^a
        Send,{Backspace}
        Send, store.steampowered.com/account
        Send, {enter}
        MsgBox %LoopReadLine%
    }
}
return

1 个答案:

答案 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:    
Loop, read, accounts.txt    ; the file name must be separated by a comma
{
    ; MsgBox %A_LoopReadLine%
    loop, parse, A_LoopReadLine, %A_Tab%
    {                
        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}
        ; Use:
        ; SendInput, %A_LoopField%
        ; if you want to send the current substring (field) from the line
        MsgBox %A_LoopField%
    }
}
return