如何让我的左键单击在自动热键上播放随机选择的声音?

问题描述 投票:0回答:1

我一直在网上查找指南,但似乎找不到任何可以让我在单击左键时从选择的声音文件中随机选择声音的东西。

~LButton::SoundPlay, C:\Users\xxxxx\xxxxxxxxx\Documents\8.wav

到目前为止,这就是我所拥有的,但我不确定如何让它在其他声音文件之间做出决定,类似地从 1 到 12 命名

我尝试在线复制代码,它有类似的情况,但它们没有工作和其他麻烦,也许只是一个简单的随机变量,但我不知道该怎么做

autohotkey
1个回答
0
投票
#Requires AutoHotkey v1.1

~LButton::
    Random, Nr, 1, 12  ; generates a random number between 1 and 12 each time you press LButton
    SoundPlay, C:\Users\xxxxx\xxxxxxxxx\Documents\%Nr%.wav
return

https://www.autohotkey.com/docs/v1/lib/Random.htm

#Requires AutoHotkey v2.0

~LButton::{
    Nr := Random(1, 12)
    SoundPlay "C:\Users\xxxxx\xxxxxxxxx\Documents\" Nr ".wav"
}

https://www.autohotkey.com/docs/v2/lib/Random.htm

© www.soinside.com 2019 - 2024. All rights reserved.