Musique .bat

Pokfow -  
Hackoo Messages postés 58 Statut Membre -
Bonjour, j'ai créer un fichier en .bat qui ouvre une musique, j'ai réussi à mettre l'exécution du fichier .bat en mode réduite mais la musique elle s'ouvre dans le lecteur et la fenêtre s'ouvre en grand sur l'écran.
Il y a t-il un moyen de réduire une fenêtre avec une commande en Batch ?
Il y a beaucoup de forum sur ce sujet mais je ne trouve rien que je puisse comprendre !
Je ne suis pas très fort en Batch.

Merci d'avance pour vos réponses.

4 réponses

  1. fmq Messages postés 4899 Date d'inscription   Statut Contributeur Dernière intervention   721
     
    chalut

    j'ai eu le meme probleme ....difficile de mettre en pratique ce que l'on trouve sur le net
    perso j'ai fait un bat pour ecouter les url youtube du forum zik/radio dans vlc
    la soluce qui marche chez moi .......creer un raccourci du bat
    et executer ce raccourci en fenetre reduite

    cia ciao

    1
  2. Pokfow
     
    Le problème de mon coter c'est que je créer un jeu, cependant je ne veux pas que cette dernière reste fermé. Je cherche juste que au démarrage de vmplayer.exe il se réduisent instantanément.
    0
    1. fmq Messages postés 4899 Date d'inscription   Statut Contributeur Dernière intervention   721
       
      j'ai du mal a te suivre !
      si ce n'est pas confidentiel defense .....tu peux poster ton code

      mici

      cia ciao
      0
      1. Pokfow > fmq Messages postés 4899 Date d'inscription   Statut Contributeur Dernière intervention  
         
        Je n'ai pas encore commence le jeu du a ce problème la donc pas de poblème de confidentialité

        @echo off

        mode con: cols=70 lines=12

        echo.
        echo.
        echo.
        echo.
        echo.
        echo For the best game's experience, press ALT + ENTER
        echo After, press any key
        echo.
        echo.
        echo.
        echo.
        echo.

        pause>nul

        timeout /t 1 /nobreak>nul

        start music_chap1.mp3

        mode con: cols=70 lines=12



        :start
        cls
        echo.
        echo.
        echo Days : 1
        timeout /t 1 /nobreak>nul
        echo Time : 7h32


        pause>nul
        exit
        0
      2. Pokfow > fmq Messages postés 4899 Date d'inscription   Statut Contributeur Dernière intervention  
         
        Je n'ai pas encore commence le jeu du a ce problème la donc pas de poblème de confidentialité

        @echo off

        mode con: cols=70 lines=12

        echo.
        echo.
        echo.
        echo.
        echo.
        echo For the best game's experience, press ALT + ENTER
        echo After, press any key
        echo.
        echo.
        echo.
        echo.
        echo.

        pause>nul

        timeout /t 1 /nobreak>nul

        start music_chap1.mp3

        mode con: cols=70 lines=12



        :start
        cls
        echo.
        echo.
        echo Days : 1
        timeout /t 1 /nobreak>nul
        echo Time : 7h32


        pause>nul
        exit
        0
      3. fmq Messages postés 4899 Date d'inscription   Statut Contributeur Dernière intervention   721 > Pokfow
         
        perso j'ai utilisé start /.min
        cia ciao
        0
  3. Hackoo Messages postés 58 Statut Membre 3
     
    Voici une solution à votre problème depuis cette source ici :

    https://www.reddit.com/r/Batch/comments/uv7idb/how_to_play_a_wav_sound_in_batch/?utm_source=share&utm_medium=web2x&context=3

    @echo off
    Title Play MP3 URL In Background
    Mode 60,6 & color 0B
    SET "URL_MP3=http://retro.dancewave.online/retrodance.mp3"
    echo(
    echo(    ====================================================
    Echo(      We are trying to play "RetroDance" in background
    echo(    ====================================================
    Call :Play %URL_MP3% RetroDance
    Pause>nul & Exit
    ::-----------------------------------------------------------
    :Play <URL> <Title>
    (
    	echo Play "%~1"
    	echo Sub Play(URL^)
    	echo 	Dim Sound
    	echo 	Set Sound = CreateObject("WMPlayer.OCX"^)
    	echo 	Sound.URL = URL
    	echo 	Sound.settings.volume = 100
    	echo 	Sound.Controls.play
    	echo 	While Sound.playState ^<^> 1
    	echo 		wscript.sleep 100
    	echo 	Wend
    	echo End Sub
    )>"%Temp%\PlayMusic.vbs"
    start "%~2" /Min cscript.exe //nologo "%Temp%\PlayMusic.vbs"
    exit /b
    ::-----------------------------------------------------------

    0
    1. brucine Messages postés 24799 Date d'inscription   Statut Membre Dernière intervention   4 164
       
      Bonjour,

      Certes, mais ce n'est pas du "batch", faisant appel à un script externe.

      Il y a de multiples alternatives sur le même thème au lieu de vbs (PowerShell, Python....), la solution passant par batch "pur" étant réputée impossible même en lançant le batch par un raccourci en fenêtre réduite ou en spécifiant complètement le chemin:

      start /min wmplayer.exe "chemin de ma musique"

      Cela tiendrait à ce que WMP ne supporte pas ces options.

      Une solution "batch pur" est proposée ici en attribuant l'exécution des fichiers mp3 à VLC plutôt qu'à WMP et en réduisant l'exécution de VLC à la barre des tâches:

      https://stackoverflow.com/questions/28071263/starting-a-program-minimized-via-batch
      0
  4. Hackoo Messages postés 58 Statut Membre 3
     
    Voici une source qui va placer les stations radios dans un menu dynamique avec création d'un raccourci sur votre bureau de ce même batch que vous pouvez aussi le lancer avec un HOTKEY : Ctrl +R
    @echo off & Title Playing Some Radios Stations
    REM First we create a Shortcut with a Hotkey "CTRL+R" by calling this sub like this way : 
    REM CreateShortcut <ApplicationPath> <ShortcutName> <Icon> <HotKey>
    Call :CreateShortcut "%~f0" "Radios Stations" "%Windir%\System32\SHELL32.dll,138" "CTRL+R"
    :menuLOOP
    Title Playing Some Radios Stations
    Color 9E & Mode 80,18
    ::===========================================================================
    echo(
    echo(
    echo(       ***************************** Menu ******************************
    echo(
    @for /f "tokens=2* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do (
    echo(                 %%A  %%B)
    echo(
    echo(       *****************************************************************
    echo( &Set /p Selection=Make a Selection or hit ENTER to quit: ||Goto :EOF
    echo( & Call:menu_[%Selection%]
    GOTO:menuLOOP
    ::===========================================================================
    :menu_[1] Play DJ Buzz Radio Station
    Call :StopMusic
    Set "Music_URL=https://stream.initialradio.fr:8443/djbuzz-192k.mp3"
    Call :Play "%Music_URL%" "Playing DJ Buzz Radio Station"
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :menu_[2] Play RetroDance Radio Station
    Call :StopMusic
    Set "Music_URL=http://retro.dancewave.online/retrodance.mp3"
    Call :Play "%Music_URL%" "Play RetroDance Radio Station"
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :menu_[3] Play Radio Mosaique DJ Station
    Call :StopMusic
    Set "Music_URL=http://radio.mosaiquefm.net:8000/mosadj"
    Call :Play "%Music_URL%" "Playing Radio Mosaique DJ Station"
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :menu_[4] Play Radio Mosaique GOLD Station
    Call :StopMusic
    Set "Music_URL=http://radio.mosaiquefm.net:8000/mosagold"
    Call :Play "%Music_URL%" "Playing Radio Mosaique GOLD Station"
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :menu_[5] Play Radio 100% HIT JFM Station
    Call :StopMusic
    Set "Music_URL=http://streaming2.toutech.net:8000/jfmweb4"
    Call :Play "%Music_URL%" "Playing Radio 100%%%% HIT JFM Station"
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :menu_[6] Play Radio 100% GOLD JFM Station 
    Call :StopMusic
    Set "Music_URL=http://streaming2.toutech.net:8000/jfmweb2"
    Call :Play "%Music_URL%" "Playing Radio 100%%%% GOLD JFM Station"
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :menu_[7] Play Radio 100% CLUBBING JFM Station
    Call :StopMusic
    Set "Music_URL=http://streaming2.toutech.net:8000/jfmweb3"
    Call :Play "%Music_URL%" "Playing Radio 100%%%% CLUBBING JFM Station"
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :menu_[8] Play Generation Dance Radio
    Call :StopMusic
    Set "Music_URL=http://generationdance.lu:8010/hd"
    Call :Play "%Music_URL%" "Playing Generation Dance Radio"
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :menu_[9] Stop Stremaing Radio station
    Call :StopMusic
    Goto:menuLoop
    ::---------------------------------------------------------------------------
    :Play <URL> <Title>
    (
    	echo Play "%~1"
    	echo Sub Play(URL^)
    	echo 	Dim Sound
    	echo 	Set Sound = CreateObject("WMPlayer.OCX"^)
    	echo 	Sound.URL = URL
    	echo 	Sound.settings.volume = 100
    	echo 	Sound.Controls.play
    	echo 	While Sound.playState ^<^> 1
    	echo 		wscript.sleep 100
    	echo 	Wend
    	echo End Sub
    )>"%Temp%\PlayMusic.vbs"
    start "%~2" /Min cscript.exe //nologo "%Temp%\PlayMusic.vbs"
    exit /b
    ::-----------------------------------------------------------------------------
    :StopMusic
    Taskkill /IM "cscript.exe" /F >Nul 2>&1
    Exit /B
    ::-----------------------------------------------------------------------------
    :CreateShortcut <ApplicationPath> <ShortcutName> <Icon> <HotKey>
    (
    	echo Call Shortcut("%~1","%~2","%~3","%~4"^)
    	echo Sub Shortcut(ApplicationPath,Name,Icon,HotKey^)
    	echo	Dim objShell,DesktopPath,objShortCut,MyTab
    	echo	Set objShell = CreateObject("WScript.Shell"^)
    	echo	MyTab = Split^(ApplicationPath,"\"^)
    	echo	If Name = "" Then
    	echo		Name = MyTab(UBound^(MyTab^)^)
    	echo	End if
    	echo	DesktopPath = objShell.SpecialFolders("Desktop"^)
    	echo	Set objShortCut = objShell.CreateShortcut(DesktopPath ^& "\" ^& Name ^& ".lnk"^)
    	echo	objShortCut.TargetPath = Chr(34^) ^& ApplicationPath ^& Chr^(34^)
    	echo	ObjShortCut.IconLocation = Icon
    	echo	ObjShortCut.WorkingDirectory = "%~dp0"
    	echo	objShortCut.HotKey = Hotkey
    	echo	objShortCut.Save
    	echo End Sub
    )>"%temp%\Shortcutme.vbs"
    wscript "%temp%\Shortcutme.vbs" & Del "%temp%\Shortcutme.vbs"
    Exit /b
    ::------------------------------------------------------------------------------


    Remarque : Posté pour la 1ère fois ici : https://www.reddit.com/r/Batch/comments/rlm3ss/playing_some_radios_stations_with_a_dynamic_menu/?utm_source=share&utm_medium=web2x&context=3
    0