Please help with SoundBeep <3

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SaltiestSaltySaltPie
Posts: 2
Joined: 15 Aug 2018, 13:55

Please help with SoundBeep <3

15 Aug 2018, 14:05

THanks for dropping by
I want to make a script, it has some valueA that decrease in frequency everytime i press a, same goes for when i hit d the frequency of valueA goes up, and when i press s the value return to default.
I am a newbie, just wanted to know if it is even possible, and maybe enlighten me :P .
Thanks for your time. $a::
{
Numpad1
SoundBeep, %SomeValueA
}
Return
$s::
{
Numpad2
SoundBeep, %SomeValueA
}
Return
$d::
{
Numpad3
SoundBeep, %SomeValueA
}
Return
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Please help with SoundBeep <3

15 Aug 2018, 17:21

Code: Select all

DEFAULT_FREQ := freq := 1000
MAX_FREQ := 1500
MIN_FREQ := 500
INCR := 100

beep(freq) {
	static DURATION := 200

	SoundBeep % freq, % DURATION
}

a::beep((freq -= INCR) < MIN_FREQ ? freq := MIN_FREQ : freq)
s::beep(freq := DEFAULT_FREQ)
d::beep((freq += INCR) > MAX_FREQ ? freq := MAX_FREQ : freq)
SaltiestSaltySaltPie
Posts: 2
Joined: 15 Aug 2018, 13:55

Re: Please help with SoundBeep <3

15 Aug 2018, 21:13

@swagfag YOU ARE MY HERO <3
I learned so much
This is my final code



DEFAULT_FREQ := freq := 5000
MAX_FREQ := 7500
MIN_FREQ := 2500
INCR := 100

beep(freq) {
static DURATION := 150

SoundBeep % freq, % DURATION
}

$a::
{
Send, {Numpad1}
beep((freq -= INCR) < MIN_FREQ ? freq := MIN_FREQ : freq)
}
Return
b::
{
Send, {Numpad2}
beep(freq := DEFAULT_FREQ)
}
Return
d::
{
Send, {Numpad3}
beep((freq += INCR) > MAX_FREQ ? freq := MAX_FREQ : freq)
}
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], haomingchen1998, robodesign and 249 guests