multitreadh

09/09/2012 12:28 fuso98#1
how i can make a multitreadh for a bot?? I know that autoit don't support multitreadh but i saw a lot of script that simulate multitreadh...

es. I've 8 function and one gui with start button and 8 checkbox. At button pressed if checkbox 1 is checked then run func 1, if checkbox 1 and checkbox 2 are checked then run func 1 and 2...if all checkbox are checked then run all func...
How i make it??
09/09/2012 12:59 Achat#2
Example:
Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 32, 16, 81, 41)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 24, 64, 105, 49)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 24, 128, 129, 49)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 8, 200, 153, 65)
$Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 24, 304, 113, 41)
$Checkbox6 = GUICtrlCreateCheckbox("Checkbox6", 208, 32, 97, 49)
$Checkbox7 = GUICtrlCreateCheckbox("Checkbox7", 216, 112, 129, 57)
$Checkbox8 = GUICtrlCreateCheckbox("Checkbox8", 200, 192, 105, 73)
$Button1 = GUICtrlCreateButton("Button1", 224, 336, 113, 81)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		case $Button1
			If GUICtrlRead($Checkbox1) = 1 Then
				_Func1()
			EndIf
			If GUICtrlRead($Checkbox2) = 1 Then
				_Func2()
			EndIf
			;....

	EndSwitch
WEnd
€dit: For that you could use arrays and a for-loop.

Regards
09/09/2012 13:20 fuso98#3
ok but it run script in loop, i want that it run func simultaneously
09/09/2012 14:12 KDeluxe#4
Code:
Dim $Paused = True, $Checkbox[10]

GUICreate("", 100, (UBound($Checkbox) + 1) * 30)
For $i = 0 To UBound($Checkbox) - 1
	$Checkbox[$i] = GUICtrlCreateCheckbox("Checkbox " & $i, 5, 5 + $i * 30)
Next
$btn_Start = GUICtrlCreateButton("Start", 5, UBound($Checkbox) * 30, 90)
GUISetState()

While Sleep(10)
	Switch GUIGetMsg()
		Case -3
			Exit
		Case $btn_Start
			$Paused = Not $Paused
			If $Paused Then
				GUICtrlSetData($btn_Start, "Start")
			Else
				GUICtrlSetData($btn_Start, "Stop")
			EndIf
	EndSwitch

	If Not $Paused Then
		For $i = 0 To UBound($Checkbox) - 1
			If GUICtrlRead($Checkbox[$i]) == 1 Then Call("_Func" & $i)
		Next
	EndIf
WEnd

Func _Func0()
	;..
EndFunc

;...
09/10/2012 15:07 K1ramoX#5
multithreading works in autoit with asm functions ;o
09/10/2012 16:00 fuso98#6
what are asm function ?? sorry my n00b question