Options

How to play WAV files in NAV?

It4Ch1It4Ch1 Member Posts: 36
I need to play different wav files in NAV to accommodate each prompt: CONFIRM, MESSAGE, ERROR,..

how to do this?

I already tried using OCX windows media player. How do I hide the player?

the other alternative:

using BEEP()

2 beeps:-
BEEP(1925,22);
SLEEP(100);
BEEP(1925,22);

Answers

  • Options
    MalajloMalajlo Member Posts: 294
  • Options
    It4Ch1It4Ch1 Member Posts: 36
    I tried to extract the part for opening the mp3 file

    already set the correct global variable for WMPlayer.

    used this:
    WMPlayer.Open(<file name>);

    but nothing happened.
  • Options
    ta5ta5 Member Posts: 1,164
    Did you try the hyperlink command from navision. I didn't try, but I guess it should work, hyperlink opens a file with the standard program.
    Hope this helps
    Thomas
  • Options
    KYDutchieKYDutchie Member Posts: 345
    You can use the automation type for this.
    The one that is really easy to use is :"Microsoft NetShow Player.NSPlay"

    here is a simple form that uses this automation
    OBJECT Form 70000 tsplayer
    {
      OBJECT-PROPERTIES
      {
        Date=04/30/10;
        Time=[ 8:29:26 AM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        Width=8000;
        Height=8000;
        OnCloseForm=BEGIN
                      CLEAR(tswmplayer);
                    END;
    
      }
      CONTROLS
      {
        { 1000000000;CommandButton;880;5610;2200;550;CaptionML=ENU=Play;
                                                     OnPush=BEGIN
                                                              IF ISCLEAR(tswmplayer) THEN
                                                                CREATE(tswmplayer);
    
                                                              tswmplayer.Open('H:\leek spinning polka.mp3');
                                                            END;
                                                             }
        { 1000000001;CommandButton;3300;5610;2200;550;
                                                     CaptionML=ENU=Stop;
                                                     OnPush=BEGIN
                                                              IF NOT ISCLEAR(tswmplayer) THEN
                                                                tswmplayer.Stop();
                                                            END;
                                                             }
      }
      CODE
      {
        VAR
          tswmplayer@1000000000 : Automation "{2179C5D0-EBFF-11CF-B6FD-00AA00B4E220} 1.0:{2179C5D3-EBFF-11CF-B6FD-00AA00B4E220}:'Microsoft NetShow Player'.NSPlay";
    
        EVENT tswmplayer@1000000000::KeyDown@-602(KeyCode@1000000001 : Integer;ShiftState@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::KeyUp@-604(KeyCode@1000000001 : Integer;ShiftState@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::KeyPress@-603(CharacterCode@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::MouseDown@-605(Button@1000000003 : Integer;ShiftState@1000000002 : Integer;x@1000000001 : Variant;y@1000000000 : Variant);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::MouseUp@-607(Button@1000000003 : Integer;ShiftState@1000000002 : Integer;x@1000000001 : Variant;y@1000000000 : Variant);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::Click@-600(Button@1000000003 : Integer;ShiftState@1000000002 : Integer;x@1000000001 : Variant;y@1000000000 : Variant);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::DblClick@-601(Button@1000000003 : Integer;ShiftState@1000000002 : Integer;x@1000000001 : Variant;y@1000000000 : Variant);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::MouseMove@-606(Button@1000000003 : Integer;ShiftState@1000000002 : Integer;x@1000000001 : Variant;y@1000000000 : Variant);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::ScriptCommand@3001(scType@1000000001 : Text[1024];Param@1000000000 : Text[1024]);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::EndOfStream@3002(Result@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::Buffering@3003(Start@1000000000 : Boolean);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::Disconnect@3004(Result@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::StateChange@3005(OldState@1000000001 : Integer;NewState@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::MarkerHit@3006(MarkerNum@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::AutoStartFailure@3007(Result@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::NewStream@3008();
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::Warning@3009(WarningType@1000000002 : Integer;Param@1000000001 : Integer;Description@1000000000 : Text[1024]);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::Error@3010();
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::OpenStateChange@3011(OldState@1000000001 : Integer;NewState@1000000000 : Integer);
        BEGIN
        END;
    
        EVENT tswmplayer@1000000000::PlayStateChange@3012(OldState@1000000001 : Integer;NewState@1000000000 : Integer);
        BEGIN
        END;
    
        BEGIN
        END.
      }
    }
    
    

    In order to prevent automation errors always make sure that the file can be opened by the user before playing it.

    Hope this helps,

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • Options
    SavatageSavatage Member Posts: 7,142
    Add A global

    WMPlayer -> OCX ->Windows Media Player

    NOTE!!! There are usually 2 choices
    C:\WINDOWS\system32\msdxm.ocx <<<You want this one!!!!!
    C:\WINDOWS\system32\wmp.dll

    Add your code to on open form or whereever - CU1 with a "Welcome.WAV" for example..
    1 line real simple, we use this for scanning. After the code is complete it makes a sound so we know its done and we can move to the next package.
    OnOpenForm()
    WMPlayer.Open ('X:\Sounds\WELCOMEF.WAV');

    Save->Compile->Enjoy!

    You can place all your working sounds in the Nav Database Folder (Networked Folder) so all can access the file.
    http://www.waveevents.com/MyFilez/wavs/ ... lcomef.wav

    here's another you can have fun with on a confirm :lol: ..
    http://www.waveevents.com/MyFilez/wavs/ ... smastr.wav

    Here's the orig post from 2006 - thanks to Luc for Resurrecting it.
    viewtopic.php?t=13007
  • Options
    It4Ch1It4Ch1 Member Posts: 36
    Savatage wrote:
    Add A global

    WMPlayer -> OCX ->Windows Media Player

    NOTE!!! There are usually 2 choices
    C:\WINDOWS\system32\msdxm.ocx <<<You want this one!!!!!
    C:\WINDOWS\system32\wmp.dll

    Add your code to on open form or whereever - CU1 with a "Welcome.WAV" for example..
    1 line real simple, we use this for scanning. After the code is complete it makes a sound so we know its done and we can move to the next package.
    OnOpenForm()
    WMPlayer.Open ('X:\Sounds\WELCOMEF.WAV');

    Save->Compile->Enjoy!

    You can place all your working sounds in the Nav Database Folder (Networked Folder) so all can access the file.
    http://www.waveevents.com/MyFilez/wavs/ ... lcomef.wav

    here's another you can have fun with on a confirm :lol: ..
    http://www.waveevents.com/MyFilez/wavs/ ... smastr.wav

    Here's the orig post from 2006 - thanks to Luc for Resurrecting it.
    viewtopic.php?t=13007

    This works! thanks! =D>
  • Options
    SavatageSavatage Member Posts: 7,142
Sign In or Register to comment.