Lancer un .mp3 avec wmplayer en VBS ?
Résolu
Snowmann
Messages postés
239
Statut
Membre
-
Snowmann Messages postés 239 Statut Membre -
Snowmann Messages postés 239 Statut Membre -
Bonjour, comme indiqué dans le titre je cherche une commande qui permet de lancer un fichier mp3 avec wmplayer même si (pour ma part) le lecteur par défaut est groove musique.
En batch cela donnerait ceci : start wmplayer /k "lechemindufichier.mp3" mais il me le faudrait en VBS...
Merci pour vos réponses ou mêmes propositions,
Snowmann.
En batch cela donnerait ceci : start wmplayer /k "lechemindufichier.mp3" mais il me le faudrait en VBS...
Merci pour vos réponses ou mêmes propositions,
Snowmann.
A voir également:
- Vba mp3
- Mp3 gain - Télécharger - Édition & Montage
- Télécharger musique mp3 gratuitement sur pc - Télécharger - Conversion & Extraction
- Youtube mp3 - Guide
- Télécharger podcast mp3 gratuit - Guide
- Convertisseur mp3 gratuit pour pc - Télécharger - Conversion & Extraction
Voilà
Call AskQuestion() '***************************************************************************** Sub Play(URL) Dim Sound Set Sound = CreateObject("WMPlayer.OCX") Sound.URL = URL Sound.settings.volume = 100 Sound.Controls.play do while Sound.currentmedia.duration = 0 wscript.sleep 100 loop wscript.sleep (int(Sound.currentmedia.duration)+1)*1000 End Sub Sub AskQuestion() Dim Question,MsgFR MsgFR = "Voulez-vous ouvrir un fichier audio?" & vbcr & "Oui = Pour écouter" & vbcr & "Non = Pour arrêter" & vbcr & String(50,"*") Question = MsgBox(MsgFR,vbYesNO+vbQuestion+vbSystemModal,Title) If Question = VbYes Then Call Play ("C:\Users\LePivert\Music\Lecteur MP3\10-tu vuo fa l'americano.mp3")'jouer adapter le chemin End If If Question = VbYes Then MsgBox "Il y a une autre instance en cours d'exécution !" WScript.Quit() End If If Question = VbNo Then Call Kill("wscript.exe") End If If Question = VbNo Then Call Kill("wscript.exe") End If End Sub '***************************************************************************** 'Fonction pour ajouter les doubles quotes dans une variable Function DblQuote(Str) DblQuote = Chr(34) & Str & Chr(34) End Function '****************************************************************************** Function CommandLineLike(ProcessPath) ProcessPath = Replace(ProcessPath, "\", "\\") CommandLineLike = "'%" & ProcessPath & "%'" End Function '****************************************************************************** Sub Kill(MyProcess) Dim Titre,colItems,objItem,Processus,Question Titre = " Processus "& DblQuote(MyProcess) &" en cours d'exécution " Set colItems = GetObject("winmgmts:").ExecQuery("Select * from Win32_Process " _ & "Where Name like '%"& MyProcess &"%' AND commandline like " & CommandLineLike(WScript.ScriptFullName) & "",,48) For Each objItem in colItems objItem.Terminate(0)' Tuer ce processus Next End Sub '******************************************************************************Et seule la msgbox fonctionne d'ailleurs...