Jump to content

Random beep on keyboard press?


kp3
 Share

Recommended Posts

This is what ive got so far:

#include <misc.au3>
While 1
    sleep(10)
    For $i = 0 to 255
        if (_IsPressed(Hex($i))) Then
            beep (100,200)
        EndIf
    Next

I want it to play a random beep, only sound when i press the letter keys and i dont want the beep to repeat so fast... When i press one key i only want 1 beep at the time

PLZZZ help me

[s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I

Link to comment
Share on other sites

This is what ive got so far:

#include <misc.au3>
While 1
    sleep(10)
    For $i = 0 to 255
        if (_IsPressed(Hex($i))) Then
            beep (100,200)
        EndIf
    Next

I want it to play a random beep, only sound when i press the letter keys and i dont want the beep to repeat so fast... When i press one key i only want 1 beep at the time

PLZZZ help me

take a look in the help file for hotkeyset

you can have 64 key simultaneously

:lmao:

Link to comment
Share on other sites

#include <misc.au3>
While 1
    For $i = 0 to 255
        If _IsPressed(Hex($i)) Then ;Why the ( ) around the _IsPressed?
            Select
                Case $i = Random(1, 255, 1)
                    Beep(100,200)
            EndSelect
        EndIf
    Next
    Sleep(10)
WEnd

; Untested, Just a guess.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

sry =P Not working. If i use hotkey i cant write =P

And azkay urs not working either. I want it to sound when i press the LETTER keys only and i dont want it to sound sometimes, i want it to sound on every click but a diffrent beep everytime

Edited by kp3

[s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I

Link to comment
Share on other sites

Oh, Thats what you want xD

#include <misc.au3>
While 1
    For $i = 0 to 255
        If _IsPressed(Hex($i)) Then Beep(Random(1000, 10000, 10), 100)
    Next
    Sleep(10)
WEnd

This?

I just want it to use the letter keys! But the beep works good. But i only want the letter keys...Not mouse and enter and stuff

[s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I

Link to comment
Share on other sites

I just want it to use the letter keys! But the beep works good. But i only want the letter keys...Not mouse and enter and stuff

Well, Then copy that code, but for each button.
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

I would like to know what this is for before posting a solution.

I like nousy key presses xD I dont have a old keyboard so i guess il have to make the clicks to beeps =)

[s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I

Link to comment
Share on other sites

HotKeySet("{Esc}", "_Terminate")
$dll = DllOpen("user32.dll")
While _IsPressedMod($dll) ; clear buffer
    ; just waiting for buffer to clear
WEnd
$letter = ""
While 1
    $letter = _IsPressedMod($dll)
    If $letter Then Beep(Random(1000, 10000, 10), 100)
    Sleep(10)
WEnd

Func _IsPressedMod($h_dll = "user32.dll")
    Local $aR, $bRv, $hexKey, $i
    For $i = 65 To 90
        $hexKey = '0x' & Hex($i, 2)
        $aR = DllCall($h_dll, "int", "GetAsyncKeyState", "int", $hexKey)
        If $aR[0] <> 0 Then Return Hex($hexKey, 2)
    Next
    Return 0
EndFunc   ;==>_IsPressedMod

Func _Terminate()
    DllClose($dll)
    Exit
EndFunc   ;==>_Terminate

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...