【问题标题】:How does AutoHotKey determine if a copied string is a number?AutoHotKey 如何判断复制的字符串是否为数字?
【发布时间】:2013-10-02 16:41:48
【问题描述】:

以下 AutoHotKey sn-p 应该是:

  1. 验证复制的字符串是否为数字
  2. 如果有,请在网站和 Windows 搜索中搜索该号码。

什么都没有发生。 If 的表达式看不到整数并绕过代码。

有什么想法吗?

Send ^c
sss = ClipBoard

if sss is integer
{
    Run, https://sd.borschow.com:8443/SREdit.jsp?id=%sss%
    Run, search-ms:query=%sss%
}

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    文本副本通常不如 AHK 执行后续代码那么快。也就是需要等待剪贴板更新:

    F9::
        oldClip := ClipboardAll
        Clipboard := ""
        Send, ^c
        ClipWait
        clip := Clipboard
        if clip is integer
        {
            msgbox, integer
        }
        else
        {
            msgbox, not an integer
        }
        Clipboard := oldClip
        ; we better make that empty, since it could contain sensitive data
        oldClip := "" 
    return
    

    最佳做法是存储剪贴板,将其清空,触发复制,然后等待剪贴板包含某些内容。最后,如果您不再需要内容,请恢复旧剪贴板。

    【讨论】:

      猜你喜欢
      • 2011-05-31
      • 2010-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-26
      • 2010-11-21
      相关资源
      最近更新 更多