Sign in to follow this  
Followers 0
piccaso

Kill your speaker :)

11 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Do you have to do something special to do a dllcall, cause i'm getting an error: "unknown Funktion Name (dllcall)"

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

yeah unstable enough to use.

You guys could always just use something else.

This has got to best compiler for scripts I've ever found, anyone got anything different.

Edited by Digetal

Share this post


Link to post
Share on other sites

if you have to use latest beta anyways, what about using the "Beep" function implemented in AutoIt ;)

take a look at the helpfile and look for the funtion "Beep"

syntax: Beep ( [ Frequency [, Duration ]] )

Mikon

Share this post


Link to post
Share on other sites

You guys realize this thread is a year old...

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Doesn't matter, my function (Beep, in the latest BETA) was recognized ! ;)

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0