Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
running a macro/function at same time
#5
Macro thread_master
Code:
Copy      Help
;start 3 threads
mac("thread_slave")
mac("thread_slave")
mac("thread_slave")

mes "The main macro is running.[][]To test other threads, run or activate Notepad.[][]Click OK to end all." ;;show message box; it waits until you close

;end all threads
shutdown -6 0 "thread_slave"

Function thread_slave
Code:
Copy      Help
rep
,out F"loop: thread {GetCurrentThreadId}"
,0.5
,
,lock ;;prevents executing code between lock and lock- by multiple threads simultaneously. Other threads will be paused.
,
,ifa "Notepad" ;;if Notepad window active
,,mes F"thread {GetCurrentThreadId} is doing something"
,,
,lock-


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)