好的,所以我有这个 AutoHotkey 片段:
; Google text from any app
; from http://superuser.com/questions/7271/most-useful-autohotkey-scripts/165220#165220
#s::
MyClip := ClipboardAll
clipboard = ; empty the clipboard
Send, ^c
ClipWait, 2
if ErrorLevel ; ClipWait timed out.
return
Run http://www.google.com/#hl=en&q=%clipboard%
Clipboard := MyClip
Run Code Online (Sandbox Code Playgroud)
它工作正常,但我想改进它以处理您突出显示 URL 并自动运行 URL 本身 ( Run %clipboard%) 而不是 Google 搜索的情况。如何让 AutoHotkey 检测字符串是否为 URL?
似乎我可以使用StringLeftorSubStr提取前几个字符并查看它们是否匹配http://or www.,或者使用正则表达式可能更强大?不过,我不太了解 AHK 的语法。
此脚本检查剪贴板中的 URL,显然使用StringGetPos,但我不想检测 www 是否出现在字符串中的任何位置。仅当它出现在开头时。
来自http://docs.python.org/2/library/math.html:
math.frexp(x)的
返回尾数和x的指数作为对(m,e).m是一个浮点数,e是一个整数,使得x == m*2**e.如果x为零,则返回(0.0,0),否则0.5 <= abs(m)<1.这用于以便携方式"分离"浮点的内部表示.
math.modf(x)的
返回x的小数和整数部分.两个结果都带有x的符号并且是浮点数.
在这个相关的问题中,它指出返回浮点数对于ceil和floor都没有意义,所以在Python 3中,它们被改为返回整数.是否有一些原因导致整数结果modf也不作为整数返回?在Python 2.7中:
In [2]: math.floor(5.5)
Out[2]: 5.0
In [3]: math.modf(5.5)
Out[3]: (0.5, 5.0)
In [4]: math.frexp(5.5)
Out[4]: (0.6875, 3)
Run Code Online (Sandbox Code Playgroud)
在Python 3中:
In [2]: math.floor(5.5)
Out[2]: 5
In [3]: math.modf(5.5)
Out[3]: (0.5, 5.0)
In [4]: math.frexp(5.5)
Out[4]: (0.6875, 3)
Run Code Online (Sandbox Code Playgroud) 为了将多个图像平均在一起,通配符效果很好:
magick convert -average *.png out.png
Run Code Online (Sandbox Code Playgroud)
但是,如何在 Windows 命令行上指定多个输入图像而不使用通配符呢?(最终目标是制作一个批处理文件,以便我可以选择多个图像,然后使用 SendTo 菜单将它们组合起来,为此%*将收到"C:\...filename.png" "C:\...file2.png" "C:\...something.png"。)
我想从 .c 和 .h 文件中自动删除所有尾随空格,以减少导致 git 历史记录中合并冲突的垃圾等。
有什么可以想象的方法可以改变编译阶段的输出吗?或者自动执行此操作是否完全安全?
autohotkey ×1
c ×1
command-line ×1
imagemagick ×1
integer ×1
modulo ×1
python ×1
substring ×1
url ×1
whitespace ×1
windows ×1