
tevans
Brazil
Asked
— Edited
Friends, how can I control the windows media Player (or the Itunes) from ARC ? I want my robot (that has an PC inside) to play my sound library, and of course I can not put 3000 songs into an SoundBoard command... Can I ? thanks! tevans
Since I haven't used WMP or iTunes for over a decade I don't know if it has any command line parameters like other media players do, but that (or this along side a auto hot key script) is likely the best method of controlling an external application.
Steve g did something similar in a post. He might chime in.
got it! I think this will run the program, rigth?
but how do I control the Play, Stop, next, shuffle, etc... ?
thanks!
It's a pain in the hinny, you can't open the Windows Media Player directly from the Exec command.
But what you can do is create a batch file to control the media player to do what you what. You can run the batch file from the Exec command in ARC. It's very easy, you just need to make one more file.
Before I explain how, it's important to know you won't be able to control a lot, you can launch an individual file or a playlist and that's about it. Those limitations have more do with the Windows Media Player then ARC.
To Make a Batch File: Open NotePad.exe, you can do this by right clicking on your desktop and selecting New, then Text Document. This will create a new text file on your desktop, open it and it will launch in Note Pad by default. Enter the following and modify as needed:
The first part should be the same for most users, it is the location of the Windows Media Player .exe. The second part is the location of my All 80's playlist file, you would need to change this location and name of the file or the playlist you want.
Once that is entered, click File, select Save As, set the location, name it and make sure to end the file name with .bat (not .txt). Last and most important, change the Save as type to All Files . This should create a batch file, and you can test it by double clicking on it when finished. It should launch the Media Player and the file or play list.
In ARC, create a new script and enter the following, but change the path and file name to reflect your batch file.
Run the script and Media Player should launch with your file or play list.
To Close the media player, you need to create a another batch file, follow the directions from above to make the batch file, but this time enter this code in the file:
As you can see it is a lot easier to end a program than to launch it.
In ARC, make a new script and enter this code, change the path and file name to the path/file name of your batch file.
That's how you control the media player. There are no granular controls for scripted options to control the media player. I suspect the same is true for iTunes.
This site explains the control line options available for the media player, as you can see there are not many:
https://support.microsoft.com/en-us/kb/241422
Here's how I did it by using the PlayAudio Command. It's all good just how you want to do it ...
To start a music file:
Example Phrase: "Robot play music file ACDC Burning Alive"
Command: PlayAudio(d:\Music\ACDCBallBreaker\BurninAlive.mp3")
To stop a music file:
Example Phrase: "Robot stop music file"
Command:
StopAudio
The same holds true for movies if you happen to have a screen on your robot too.
Example Phrase: "Robot play movie file Star Wars.
Exec("D:\Movies\StarWars.wmv")
Note: I never knew how to stop the video player till after just reading Justin's reply so I'll give that a try next time.
Herr Ball that's another good way to play a file. I might be more inclined to add the music file to a soundboard if you wanted specific files, but your method probably makes the ezb file smaller.
What is interesting about your method, calling the file directly, is that it would open the file in whatever application you have set as the default player for the file under Windows. If you had iTunes set as the default player, it should open in iTunes which would require the batch file to be changed.
This will work to close iTunes from a batch file. If another program was set as the default the .exe file name would need to be located and changed in the batch file.
you can also stop iTunes from ARC without a batch file using this script,
David Cochran taught us that in this thread
Likewise you can stop and close Windows Media player without a batch file in ARC: