Command line control

Discussion about anything that might be of interest to MediaMonkey users.

Moderator: Gurus

pushpull
Posts: 256
Joined: Mon Aug 14, 2006 9:01 pm
Location: Formerly WNY, now Portlandia
Contact:

Command line control

Post by pushpull »

I am using a an old Yahoo widget that will pause Winamp with an incoming phone call. This is accomplished by placing the statement "if ("0" != runCommand("\"C:\\Program Files\\Winamp\\CLAmp.exe\" /PID")) runCommand("\"C:\\Program Files\\Winamp\\CLAmp.exe\" /PAUSE ON");" in an input field for an eval() parameter in the options setup.
The CLAmp.exe is a command line utility for controlling Winamp. Does anyone know of something similar for MM? Another thing that can be put into this field is tellWidget() with the example given tellWidget("mgk", "mute"). Is this supported in MM? I would rather just use MM's player than launching Winamp.
Thanks.
Lowlander
Posts: 56572
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Command line control

Post by Lowlander »

I believe the only documented command lines are: http://www.mediamonkey.com/support/inde ... ticleid=45
fizzjob
Posts: 417
Joined: Fri Mar 30, 2007 12:37 pm

Re: Command line control

Post by fizzjob »

You can fake it with a bit of vbscript. For example, this script will pause (or unpause) MediaMonkey if it's running and not stopped.

Code: Select all

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'MediaMonkey.exe'")
For Each objProcess in colProcessList
    Dim SDB : Set SDB = CreateObject("SongsDB.SDBApplication")
    if SDB.Player.IsPlaying then
       SDB.Player.Pause
    end if
Next
You can then call it with "cscript.exe \path\to\script.vbs". Personally, I use that to pause MM when I lock my PC at work (which I have to do whenever I walk away) and then unpause it when I unlock it.
Image
pushpull
Posts: 256
Joined: Mon Aug 14, 2006 9:01 pm
Location: Formerly WNY, now Portlandia
Contact:

Re: Command line control

Post by pushpull »

Thanks fizzjob. I ended up using Event Ghost to accomplish this and bypassing the widget. This worked but then I lost the Caller ID information that was displayed by the widget. I had another winamp plugin that also will pause MM but it wouldn't recognize the USB modem I was using. Do you think I can simply put the"cscript.exe \path\to\script.vbs" into the field for the eval() function? Maybe I can use the script in conjunction with the widget and Event Ghost to get back full functionality. It will give me something to play with. Since I am not a programmer or script writer I have to ask, do I just use this code "as is"? That is, is there anything in the code I have to replace or is it simply copy/paste into notepad and save with a .vbs extension? Also, you say you use it to unpause MM as well. This is accomplished simply by running the script again, so it is in essence a toggle? Thanks again.
fizzjob
Posts: 417
Joined: Fri Mar 30, 2007 12:37 pm

Re: Command line control

Post by fizzjob »

pushpull wrote:Since I am not a programmer or script writer I have to ask, do I just use this code "as is"? That is, is there anything in the code I have to replace or is it simply copy/paste into notepad and save with a .vbs extension? Also, you say you use it to unpause MM as well. This is accomplished simply by running the script again, so it is in essence a toggle? Thanks again.
The code is universal, so it should be usable as-is, and you are correct in that it functions as a toggle.
Image
pushpull
Posts: 256
Joined: Mon Aug 14, 2006 9:01 pm
Location: Formerly WNY, now Portlandia
Contact:

Re: Command line control

Post by pushpull »

fizzjob, this worked great. I had to play around with it for a while and even abandoned it for a while with another tack on EventGhost. I finally came back to the script. I was having a problem getting it to run in the field I had to work with. Finally I took "if ("0" != runCommand("\"C:\\Program Files\\Winamp\\CLAmp.exe\" /PID")) runCommand("\"C:\\Program Files\\Winamp\\CLAmp.exe\" /PAUSE ON");" and changed it to this - runCommand("\"C:\\MediamonkeyPause.vbs");. Bingo, we have ignition. The only real issue now is that it will toggle on with the next call. I don't see this as a serious issue as I don't get that many phone calls to make this a likelihood. Thanks again. I do believe I have learned something to boot.
Post Reply