Jump to content
nacerbaaziz

Request a clarification in a function to play audio files from the compiled script

Recommended Posts

nacerbaaziz
Posted (edited)

Hello all
I found this function in the Internet
It is to play audio files from  the compiled script
I did not understand just one thing on this function

func play($name, $wait = 0)
local Const $SND_RESOURCE = 0x00040004
local Const $SND_ASYNC = 1
; Play the file - the script will pause as it sounds
if $wait = 0 then
DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC))
else
DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", $SND_RESOURCE)
endIf
return 1
endFunc

What I did not understand was this variable

local Const $SND_RESOURCE = 0x00040004

I know that this variable is contains the resource name
But what if I want to change the name of the resource what i'll do?
can i do that?
Thanks in advance

 

Edited by nacerbaaziz
  • Like 1

Share this post


Link to post
Share on other sites
TheXman
Posted (edited)
4 hours ago, nacerbaaziz said:

I know that this variable is contains the resource name
But what if I want to change the name of the resource what i'll do?
can i do that?

@nacerbaaziz

$SND_RESOURCE does not contain the resource name.  It is a named, magic number, constant that tells the PlaySound function that the value identifying the sound is a resource ID as opposed to an alias or a file name.  Your questions don't seem to be related to AutoIt.  If you want to know more about the Win32 API PlaySound() function, you can start here:

https://msdn.microsoft.com/en-us/library/windows/desktop/dd743680(v=vs.85).aspx

Or

Below is link to the help file for AutoIt's _WinAPI_PlaySound() function, which is a wrapper for the Win32 API PlaySound function.

https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_PlaySound.htm

 

If I'm wrong and your question is related to AutoIt, then please explain what it is, that relates to AutoIt, that you are having trouble understanding.

 

Edited by TheXman
  • Like 1

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

  • Similar Content

    • Skeletor
      By Skeletor
      Hi All,
      It has been bugging me for a while now. 
      Can you view the AutoIt code from within a compiled exe. Like how you can with most .Net exe's by using a certain program.
      If this is possible, how then can I secure my program (if this method exists).
       
    • ademon
      By ademon
      Hi. I can open the editor with out problems but I can not compile because it is placed on another partition diferent from C.
      Can you provide an update of this bug?


    • lenclstr746
      By lenclstr746
      Hi guys,
      Some functions of my script are running slowly. Very slow. What is the reason?
      My Code:
      <snip>
    • PuneetTewani
      By PuneetTewani
      #include <IE.au3>
      #include <Tesseract.au3>
      #include <MsgBoxConstants.au3>
      #include <Math.au3>
      #include <FileConstants.au3>
      #include <StringConstants.au3>
      #include <File.au3>
      #include <ScreenCapture.au3>
      #include <sound.au3>
      #Include <WinAPI.au3>
      #include <Date.au3>
       
      $OCR_Result = _TesseractScreenCapture(0,"",1,2,220,660,500,730,1)
      $OCR_Result1 = _TesseractScreenCapture(0,"",1,2,220,660,500,730,1)
      $OCR_Result2 = _TesseractScreenCapture(0,"",1,2,220,660,500,730,1)
      $OCR_Result3 = _TesseractScreenCapture(0,"",1,2,220,660,500,730,1)

      $sound = _SoundStatus("C:\ExpertAdvisorBuyAlert.wav")
      while _nowtime < 3.30 pm
          If $sound = True Then
             if $OCR_Result1 > $OCR_Result2
             
          EndIf
      EndIf
      Wend
      Trying to ocr some values on chart in real time(once per minute) and buy/sell securities on basis of alert generated in my software.
      I am struck onto few steps.
      1. On Tesseract Screen Capture indentation parameters. How can we determine the exact parameters if I just want numeric values only.
      2. The Tesseract Screen Capture generates and error Obj1 on line 185 which needs to be resolved.
      3. Sometimes lines get overlapped with values. What to do in that case.
      3. Detecting the sound as and when it approaches and then comparing the ocr values to decide on either buy or sell.
      The values that needs to be fetched are encircled.

    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
×