0
votes

I would like my code to show 'paused' upon script being paused and show 'running' for only a short interval after the script is unpaused.

However, it did not work as expected.

My code below (commented the problematic issue):

NumpadEnter:: ; script is paused on said key and reactivated on said key
    Suspend
    ToolTip, PAUSED, 200, 250
    Pause ,, 1
; ; ToolTip, RUNNING, 200, 250 ; Code segment when un-commented does not work as it should
; ; Sleep 500                  ;
    SetTimer, RemoveToolTip, 1
return

RemoveToolTip: 
    SetTimer, RemoveToolTip, Off
    ToolTip
return

Thank you so much!!

1
what does it do currently? - donkon
what is does is that it: 1) pauses the script upon hitting the NumpadEnter key and toottip "RUNNING" gets activated (tooltip "PAUSED" seems to either be bypassed or disappear too fast); 2) upon hitting NumpadEnter again, script is unpaused and tooltip "RUNNING" is closed --- - Neo Ding Yue
I assume it has to do with Pause. The documentation says it stops the script current thread which might have the GUI tooltip autohotkey.com/docs/misc/Threads.htm - donkon

1 Answers

1
votes

Try this:

NumpadEnter::
  Suspend
  Pause ,,1
  if A_IsPaused {
    ToolTip, PAUSED, 200, 250
  } else {
    ToolTip, RUNNING, 200, 250
    SetTimer RemoveToolTip, 1000
  }
return


RemoveToolTip:
  ToolTip
  SetTimer, RemoveToolTip, Off
return