[AUTOIT] Target multiple windows with same name at the same time

04/21/2017 19:45 racheen#1
Hallo liebe epvp community, wollte fragen wie man 3 fenster mit dem selben namen zur selben zeit, gleichzeitig targetten kann. Den Code den ich zurzeit benutze sieht so aus:
Code:
Hallo liebe epvp community, ich habe ein problem mit meinem derzeitigen bot.
Ich würde gerne auf 3 accounts gleichzeitig botten, mein derzeitiges Autoit script drückt die leertaste aber nur auf das focusierte Fenster.
Meine Frage: Wie kann ich alle 3 Nostale fenster focusieren? (alle heißen Nostale)  und kann ich bei dem Fenster wo mein holy drauf ist so machen das dieses Fenster Q drückt? (HEAL skill) Danke im vorraus!
[CODE]#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global $XS_n
HotKeySet("^{F1}", "pos")
#Region ### START Koda GUI section ### Form=
$FORM1 = GUICreate("Easy Bot", 166, 119, [MENTION=408378]desktop[/MENTION]Width / 2 - 192 / 2, [MENTION=408378]desktop[/MENTION]Height / 2 - 127 / 2, $WS_POPUP)
GUISetBkColor(0x000000)
XPStyle(1)
$BUTTON1 = GUICtrlCreateButton("Exit", 48, 88, 65, 25)
GUICtrlSetColor($BUTTON1, 16711680)
GUICtrlSetBkColor($BUTTON1, 2763306)
GUICtrlSetOnEvent($BUTTON1, "Button1Click")
$RADIO1 = GUICtrlCreateRadio("Leertaste drücken", 16, 0, 145, 25)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0x000000);0xFFFFFF)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$RADIO2 = GUICtrlCreateRadio("Leertaste und x", 16, 28, 145, 25)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0x000000);0xFFFFFF)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$RADIO3 = GUICtrlCreateRadio("Stop", 16, 59, 145, 25)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0x000000);0xFFFFFF)
GUICtrlSetState(-1, 1)
GUICtrlSetFont($RADIO3, 10, 400, 0, "MS Sans Serif")
$INPUT1 = GUICtrlCreateInput("", 136, 88, 30, 25)
GUICtrlSetColor($INPUT1, 0xFF0000)
GUICtrlSetBkColor($INPUT1, 0x000000)
GUICtrlCreateUpdown($INPUT1)
GUICtrlSetData($INPUT1, 0)
XPStyle(0)
GUICtrlSetLimit(-1, 3)
WinSetTrans("Easy Bot", "", 0)
GUISetState()
For $I = 0 To 255 Step 1
	Sleep(10)
	WinSetTrans("Easy Bot", "", $I)
Next
#EndRegion ### END Koda GUI section ###
#RequireAdmin
While 1
	TRANS()
	$LEER = GUICtrlRead($RADIO1)
	$X = GUICtrlRead($RADIO2)
	$STOP = GUICtrlRead($RADIO3)
	While $LEER = 1
		$LEER = GUICtrlRead($RADIO1)
		ControlSend("NosTale", "", 0, "{Space}")
		Sleep(100)
		ControlSend("NosTale", "", 0, "{Space}")
	WEnd
	While $X = 1
		$X = GUICtrlRead($RADIO2)
		ControlSend("NosTale", "", 0, "{Space}")
		Sleep(100)
		ControlSend("NosTale", "", 0, "{Space}")
		For $a = 1 To 5
			ControlSend("NosTale", "", 0, "x")
			Sleep(100)
		Next
	WEnd
	While $STOP = 1
		TRANS()
		$STOP = GUICtrlRead($RADIO3)
		Sleep(100)
	WEnd
WEnd

Func BUTTON1CLICK()
	Exit
EndFunc   ;==>BUTTON1CLICK

Func XPStyle($OnOff = 1)
	If $OnOff And StringInStr(@OSType, "WIN32_NT") Then
		$XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
		DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
		Return 1
	ElseIf StringInStr(@OSType, "WIN32_NT") And IsArray($XS_n) Then
		DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
		$XS_n = ""
		Return 1
	EndIf
	Return 0
EndFunc   ;==>XPStyle

Func POS()
	$POS = MouseGetPos()
	WinMove("Easy Bot", "", $POS[0], $POS[1])
EndFunc   ;==>POS


Func TRANS()
	$INPUT = GUICtrlRead($INPUT1)
	If $INPUT = 0 Then
		WinSetTrans("Easy Bot", "", 254)
	ElseIf $INPUT = 1 Then
		WinSetTrans("Easy Bot", "", 192)
	ElseIf $INPUT = 2 Then
		WinSetTrans("Easy Bot", "", 129)
	ElseIf $INPUT = 3 Then
		WinSetTrans("Easy Bot", "", 66)
	EndIf
EndFunc   ;==>TRANS
[/CODE]

und ich habe 3 Fenster "Nostale" offen, und der code targetted nur das fenster was ich gerade angeklickt habe, wie kann ich das so machen, dass alle 3 fenster gleichzeitig benutzt werden? Danke im vorraus!

MfG

Racheen
04/21/2017 23:28 Regwin32#2
Lass das Programm von AutoIT starten und speicher die PID's in einem Array.
Code:
 WinGetProcess ( "title" [, "text"] )
Wenn das keine Option ist, lasst die dir das Handle geben
Code:
 WinGetHandle ( "title" [, "text"] )
und Speicher dessen Name in einem string, mit welchem du die PID einer anderen Varriable weiter verarbeiten kannst, z.B den oben genannten Array.

Edit: Falls du die Fensternamen verändern kannst, Schreibe sie einfach in Nostale 1 - 3 um
Code:
 WinSetTitle ( "title", "text", "newtitle" )
Process ID - Das ist deine Function mit der PID.
Code:
local $y = 0 //Array Indexer
Dann fragst du eine Do-Until Schleife ab (in deinem Fall until $y = 3)
Code:
ControlSend("Nostale","",$PID[$y], {"Space"})
//Wobei y dein Array-Indexer ist, am ende der schleife den Indexer verschieben.
$y = $y + 1
04/24/2017 02:25 magmet#3
pls can you explain this in english