Jump to content

Kill your speaker :)


piccaso
 Share

Recommended Posts

I just played arount with DllCall ...

func kernel32_Beep ($freq,$duration)
  ; Win95 ignores duration parameter
  ; freq : 37 -> 32767 [HZ]
   $r = dllcall("kernel32.dll","long","Beep","long",$freq,"long",$duration)
   if @error = 1 Then
         SetError(1)
         Return
      Else
         Return $r[0]
      EndIf
EndFunc

This function truly makes autoit powerfull (i mean dllcall not mine :"> )

if you miss something the api supports, you can just code it....

want to hear some funny noise?

try this one

for $i = 0 to 250
   kernel32_Beep(Random(37,32767),1)
Next

:)

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

Or ever funnier, adding some silence and randomize duration even more:

While 1
  kernel32_Beep(Random(37,32767),Int(Random(1,6)))
  If Int(Random(0,60)) = 0 Then Sleep(Int(Random(10,1001)))
  If Int(Random(0,600)) = 0 Then ExitLoop
Wend
Edited by ezzetabi
Link to comment
Share on other sites

use the latest unstable version of autoit

<{POST_SNAPBACK}>

I got ver: AutoIt v. 3.0.102.0

Do i need the AutoItX Beta, cause i think this is newest version and i still get the error ( from Syntax check..)

ERROR: DllCall(): undefined function.
  $r = DllCall("kernel32.dll","long","Beep","long",$freq,"long",$duration)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
>Exit code: 2    Time: 0.380
Edited by Konan--M
Link to comment
Share on other sites

  • 1 year later...

Never hurts to look a old threads, usually I get old threads when I search Google... Then when I post w/o looking at the date everyone kinda does that "wth?" thing. ;) Anyway. I've never seen Beep() b4. How do you add functions to Autoit? Is it hard? If I knew how I would make a way to have BlockInput() accept hotkeys.

Edit: Beep() dosn't use the default keyword :P. Beep(default) does nothing and returns 1.

Edited by gamerman2360
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...