2013-07-26 37 views
0

使用它我有開始一些文件,然後改變自己的名字,以他們的ID的功能:AutoIt的改變名稱和WinActivate

Global $PID2 = Run("java " & $chosen & ' -jar "spigot-1.6.2-R0.1.jar"', "E:\Spill\Alle spill\Minecraft\Bungee Servers\Hub", $Hide) 
    WinWaitActive("C:\Windows\system32\java.exe") 
    WinSetTitle("C:\Windows\system32\java.exe","",$PID2) 
    Global $PID3 =Run("java " & $chosen & ' -jar "spigot-1.6.2-R0.1.jar"', "E:\Spill\Alle spill\Minecraft\Bungee Servers\Survival", $Hide) 
    WinWaitActive("C:\Windows\system32\java.exe") 
    WinSetTitle("C:\Windows\system32\java.exe","",$PID3) 
    Global $PID4 =Run("java " & $chosen & ' -jar "spigot-1.6.2-R0.1.jar"', "E:\Spill\Alle spill\Minecraft\Bungee Servers\KnarWorld", $Hide) 
    WinWaitActive("C:\Windows\system32\java.exe") 
    WinSetTitle("C:\Windows\system32\java.exe","",$PID4) 
    Global $PID5 =Run("java " & $chosen & ' -jar "spigot-1.6.2-R0.1.jar"', "E:\Spill\Alle spill\Minecraft\Bungee Servers\Plotworld", $Hide) 
    WinWaitActive("C:\Windows\system32\java.exe") 
    WinSetTitle("C:\Windows\system32\java.exe","",$PID5) 
    Global $PID1 =Run("java " & $chosen & ' -jar "BungeeCord.jar"', 'E:\Spill\Alle spill\Minecraft\bungee', $Hide) 
    WinWaitActive("C:\Windows\system32\java.exe") 
    WinSetTitle("C:\Windows\system32\java.exe","",$PID1) 

我也有一個功能停止文件:

WinActivate($PID1) 
Send("end {ENTER}") 
WinActivate($PID2) 
Send("stop{ENTER}") 
WinActivate($PID3) 
Send("stop{ENTER}") 
WinActivate($PID4) 
Send("stop{ENTER}") 
WinActivate($PID5) 
Send("stop{ENTER}") 

的問題是上,代替尋找id和逐一發送想要的命令,它在任何窗口是活動的開始垃圾郵件的第二功能。我如何讓它運行一次並停止,但如果再次觸發它仍然可以工作? 整個代碼:http://pastebin.com/U8XBk4HE

回答

1

對於這些類型的任務有兩個功能:

  • SendKeepActive(...)作出的AutoIt到嘗試到活動窗口中的每個模擬擊鍵之間從發送()復位。
  • ControlSend(...)到發送鍵擊一個特定的窗口獨立地它是活動的。
0

也許你應該把WinWaitActive使其等待:

WinActivate($PID1) 
WinWaitActive($PID1) 
Send("end {ENTER}") 
+0

它做的唯一的事情是要摧毀的代碼。 @數學 – EpicKnarvik97