Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pause and resume macro
pause and restart macro from the point it was paused at.. is that possible. I just found a way to stop the macro and restart from the start.
It is not possible to pause a thread (running macro) from outside in a safe way. A thread only can pause itself, ie wait for an event.
There are Windows API functions SuspendThread and ResumeThread, but sometimes they can be dangerous, for example QM cannot correctly end a suspended thread.
Function ThreadPauseResume
Select All      Help
function $threadName flags ;;flags: 0 pause, 1 resume

;Pauses (suspends) or resumes a QM thread.

;threadName - <help #IDP_THREADS>thread</help> name.
;;;This function pauses/resumes all threads of threadName.
;;;If "", pauses/resumes all macro threads (except self), but not function, menu etc threads.

;Call this function from another thread.
;You must always resume paused threads. QM does not know about paused threads and cannot end them correctly.
;If you pause a thread several times (when it is already paused), you must resume it the same number of times (or more, it is safe). It will remain paused if you resume it just once.

;ThreadPauseResume "Function293" 0
;mes "resume"
;ThreadPauseResume "Function293" 1

int h i n m=empty(threadName)
n=EnumQmThreads(0 0 0 threadName); if(!n) ret
ARRAY(QMTHREAD) a.create(n)
EnumQmThreads &a[0] n 0 threadName
for i 0 a.len
,if(a[i].threadid=GetCurrentThreadId) continue
,if m
,,QMITEM q; qmitem(a[i].qmitemid 0 q)
,,if(q.itype) continue
,if(flags&1) ResumeThread h
,else SuspendThread h
You said here that a new version will have pause/resume. when will that be?
  • viewtopic.php?t=7142

And also, for the meantime. how exactly do i insert this to my rep/loop macro, making scroll lock as a hotkey?
scroll lock on = pause
scroll lock off = resume

Quote:You said here that a new version will have pause/resume. when will that be?
Not soon.


Macro rep loop macro
Select All      Help
int i
for i 0 100
,out i

Function PauseResumeRepLoopMacro
Trigger J 0x1     Help - how to add the trigger to the macro
Select All      Help
int scrollLocked=ifk(J 1)
OnScreenDisplay iif(scrollLocked "Pause" "Resume")
ThreadPauseResume "rep loop macro" iif(scrollLocked 0 1)
The trigger is Scroll Lock, and "Eat" is unchecked.

Forum Jump:

Users browsing this thread: 1 Guest(s)