【发布时间】:2014-12-21 06:55:08
【问题描述】:
我已阅读 Auto Hot Key 的文档,但对编写脚本很陌生。我不断收到错误。
我想要一个非常简单的脚本 - 所以当我使用热键 CTRL-ALT-N - 自动热键会创建一个随机数:
3 位 - 十进制 - 8 位
第一组的第一个数字在 1 到 4 之间。
其余的可以完全随机。
关闭我尝试编辑的示例脚本 - 但我做错了。如果有人可以提供帮助,将不胜感激!
输出应如下所示:314.99382028 第一个数字始终介于 1 和 4 之间,其余的随机数,十进制始终是第 4 个字符。
然后,它应该只是将数字粘贴到您当前在窗口中的任何位置 - 而不是弹出显示。
感谢任何可以快速查看并提供帮助的人。
火箭
^!n:: ;<-- change this if you want a diff hotkey
Chars1 = 1234
Chars2 = 1234567890
Chars3 = .
str =
clipboard =
UpperRange = 3 ;<-- use all 3 character strings
len = 12 ;<-- number of characters in the number
; generate a new number
loop, %len%
{ random,x,1,%UpperRange% ;<-- selects the Character string
random,y,1,26 ;<-- selects the character in the string
if (x = 12) ; if numeric there are only 10 digits
}
{ random,y,1,10
StringMid,z,Chars%x%,1 ;<-- grab the selected letter
str = %str%%z% ;<-- and add it to the number string
}
clipboard = %str% ;<-- put the completed string on the clipboard
Clipwait ;<-- wait for the clipboard to accept the string`
然后粘贴我的光标所在的位置 - 不知道该怎么做。
非常感谢您的帮助!
火箭
【问题讨论】:
标签: random numbers generator autohotkey