【问题标题】:Autohotkey - Pausing Script and when unpaused show 'RUNNING' on tooltipAutohotkey - 暂停脚本,当未暂停时在工具提示上显示“正在运行”
【发布时间】:2017-03-02 19:42:13
【问题描述】:

我希望我的代码在脚本暂停时显示“暂停”并且显示“正在运行” 仅在很短的时间间隔内 在脚本取消暂停后。

但是,它并没有按预期工作。

我的代码如下(注释了有问题的问题):

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

非常感谢!!

【问题讨论】:

  • 目前在做什么?
  • 它的作用是:1) 在按下 NumpadEnter 键时暂停脚本,并且提示“正在运行”被激活(提示“暂停”似乎被绕过或消失得太快); 2) 再次按下 NumpadEnter 后,脚本取消暂停,工具提示“RUNNING”关闭---
  • 我认为它与Pause 有关。文档说它停止了可能具有 GUI 工具提示 autohotkey.com/docs/misc/Threads.htm 的脚本当前线程

标签: autohotkey


【解决方案1】:

试试这个:

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

【讨论】:

  • 感谢您的回答,吉姆!
猜你喜欢
  • 1970-01-01
  • 2010-09-22
  • 2013-01-07
  • 2016-05-02
  • 2020-08-26
  • 2015-12-14
  • 1970-01-01
  • 1970-01-01
  • 2012-06-18
相关资源
最近更新 更多