Hello,
How can I achieve this? I tried it and it didn't work for me, maybe I'm doing something wrong.
Note about join()
if the initial object with function, the function will automatically called without join, I think it's a mistake, the function is supposed to be executed when join is called
thread1 := Thread(function) ; the function will call directly without calling join()
Example 1
LongOperation() {
Loop 10 {
Sleep(1000)
ToolTip("Step " A_Index " of 10")
}
}
thread1 := Thread(LongOperation)
; thread1 should work in the background while the script continues to run
MsgBox("This message should be shown before the thread completes.")
Example 2
ProcessWithCallback(data) {
Sleep(2000) ; Simulate work
return "Processed: " data
}
thread2 := Thread(ProcessWithCallback, "Test Data")
thread2.OnComplete := (*) => MsgBox("Processing completed!")
Hello,
How can I achieve this? I tried it and it didn't work for me, maybe I'm doing something wrong.
Example 1
Example 2