Announcement

Collapse
No announcement yet.

Sounding the Alert()

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sounding the Alert()

    In the EFS example Alert Once Per Bar their is a code line that play's a sound file using: Alert.playSound("train.wav");

    Can anyone please tell me what the correct syntax is to play a sound file? The help file states that the syntax is :

    Alert.playSound( sSoundFile )
    sSoundFile: Path and file name of the WAV file to play.

    I keep sound files in a folder located under Windows OS in C:\media. I've tried Alert.playSound("C:\media\bleep.wav") but that doesn't work. I'm sorry, I'm not a Javascript programmer so any help here would be appreciated.

  • #2
    Would the correct path be "C:\\media\\bleep.wav" Are the two backslahes the correct syntax?

    Comment


    • #3
      Highfield
      Yes or you could also go in the EFS settings (Tools->EFS->Settings) and redirect the path to the folder of your choice after which you should be able to just use the Alert.playSound("yourfile.wav") syntax.
      Alex

      Comment


      • #4
        Ok - that's sorted it out. One has to use a double forward slash in the path to specify the file location. (I'm now feeling very vertuous)

        Comment


        • #5
          Thank you Alexis - That is an even better solution.
          Last edited by Highfield; 08-08-2003, 04:52 AM.

          Comment


          • #6
            Does specifiying an interval with the utility function isIntraday() test specifically for the interval passed to it?

            I would like to play a sound file that is different to a sound file played if the chart interval is 30 minutes. I'm affraid that I'm not very familiar with javascript but I have tried this code below:

            if(isIntraday(30)){
            Alert.playSound("ding.wav");
            }
            else{
            Alert.playSound("dong.wav");
            }

            What happends is that it plays the dong.wav file and not the ding.wav file when in a 30 minute chart. Can someone help me with this please?

            Comment


            • #7
              Highfield
              I am not sure but I think isIntraday() does not use any parameters.
              Irrespective you can use getInterval() to specify the interval at which you want the sound to be different.
              Alex

              PHP Code:
              if (getInterval()==30){ 
              Alert.playSound("ding.wav");
              }
              else{
              Alert.playSound("dong.wav");

              Last edited by ACM; 08-12-2003, 08:11 AM.

              Comment


              • #8
                Thank you Alexis. I read the EFS.chm help file and found this:

                isIntraday( [interval] )
                Interval: Optional. Interval to be checked.
                Returns true if the script is currently processing intraday data (e.g., the script is loaded into an intraday chart).

                On that basis, I presumed that the [optional interval] would compare the chart interval.

                Comment


                • #9
                  Within an EFS script, is it possible to play two sound files, one after the other?

                  Comment


                  • #10
                    Hello Highfield,

                    You can only play one sound during a single iteration of your formula. If you have two Alert.playSound() calls back to back, for example, only the second one will be heard.
                    Jason K.
                    Project Manager
                    eSignal - an Interactive Data company

                    EFS KnowledgeBase
                    JavaScript for EFS Video Series
                    EFS Beginner Tutorial Series
                    EFS Glossary
                    Custom EFS Development Policy

                    New User Orientation

                    Comment

                    Working...
                    X