Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Random 需要帮助-使用自动热键脚本的简单随机数生成器_Random_Numbers_Generator_Autohotkey - Fatal编程技术网

Random 需要帮助-使用自动热键脚本的简单随机数生成器

Random 需要帮助-使用自动热键脚本的简单随机数生成器,random,numbers,generator,autohotkey,Random,Numbers,Generator,Autohotkey,我已经阅读了有关自动热键的文档,但对编写脚本还不熟悉。我总是出错 我想要一个非常简单的脚本-因此,当我使用热键CTRL-ALT-N时,自动热键会创建一个随机数,即: 3位-十进制-8位 第一组的第一个数字介于1和4之间 其余的可能是完全随机的 在示例脚本之外,我试图编辑一个帖子,但我做错了什么。如果有人能帮忙,我将不胜感激 输出应如下所示:314.99382028第一个数字始终介于1和4之间,其余数字为随机数,小数点始终为第四个字符 然后,它应该只是将数字粘贴到您当前在windows中的任何位置

我已经阅读了有关自动热键的文档,但对编写脚本还不熟悉。我总是出错

我想要一个非常简单的脚本-因此,当我使用热键CTRL-ALT-N时,自动热键会创建一个随机数,即:

3位-十进制-8位

第一组的第一个数字介于1和4之间

其余的可能是完全随机的

在示例脚本之外,我试图编辑一个帖子,但我做错了什么。如果有人能帮忙,我将不胜感激

输出应如下所示:314.99382028第一个数字始终介于1和4之间,其余数字为随机数,小数点始终为第四个字符

然后,它应该只是将数字粘贴到您当前在windows中的任何位置,而不是弹出显示

感谢所有能够快速查看并提供帮助的人

火箭

^!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`

^!n:: 由于您的答案在剪贴板上,您可以简单地使用:

Send, ^v
这将粘贴插入符号所在的位置,而不是鼠标光标所在的位置,因此如果要粘贴鼠标光标所在的位置,只需在…之前添加单击即可

Click
Sleep, 30
Send, ^v

如果我理解正确,这应该可以完成工作:

^!n::
    SendInput, % "{LButton}" . RandomString(1,"1234") . RandomString(2) . "." . RandomString(8)
Return

RandomString(length,chars:="0123456789") {
    charsCount := StrLen(chars)
    Loop % length {
        Random, num, 1, % StrLen(chars)
        string .= SubStr(chars,num,1)
    }
    Return string
}