Menu

Winamp pause/resume with CLEveR

2005-10-20
2013-04-17
  • Rafael Vuijk

    Rafael Vuijk - 2005-10-20

    I found a simple WinAmp command-line tool called CLEveR.
    http://www.winamp.com/plugins/details.php?id=58602
    Here is an example on how you can use it:

    ----- locked.bat -----
    @echo off
    for /F "usebackq" %%i in (`clever status`) do set STATUS=%%i
    if not "%STATUS%"=="Play" goto :EOF
    clever pause

    ----- unlocked.bat -----
    @echo off
    for /F "usebackq" %%i in (`clever status`) do set STATUS=%%i
    if "%STATUS%"=="Stop" goto :EOF
    if not "%STATUS%"=="" goto :EOF
    clever pause

     
    • Echostorm

      Echostorm - 2006-02-16

      Just whipped this up tonight.

      using System.Runtime.InteropServices;
      using System.Text;
      using System.Collections.Generic;
      using UsbWirelessSecurity;
      using System;

      namespace CsharpPlugins
      {
      [PresencePluginConfigurator("Winamp Plugin")]
          class WampPlugin : PresencePluginBase
          {
              const int WM_COMMAND = 0x111;
              const int APP_COMMAND_MEDIA_STOP = 0x00009C6F;
              const int APP_COMMAND_MEDIA_PLAY = 0x00009C6D;
             
              [DllImport("User32.dll")]
              public static extern int SendMessage
                  (int hWnd, int Msg, int wParam, [MarshalAs(UnmanagedType.LPStr)] string lParam);
              [DllImport("User32.dll")]
              public static extern int SendMessage
                  (int hWnd, int Msg, int wParam, int lParam);
              [DllImport("User32.dll")]
              public static extern int FindWindow(string strClassName, string strWindowName);
              [DllImport("User32.dll")]
              public static extern int FindWindowEx(int hwndParent,
                  int hwndChildAfter, string strClassName, string strWindowName);

              private int GetWindowHandle()
              {
                  return FindWindow("Winamp v1.x", null);
              }
             
              public override void WorkstationLocked()
              {
                  base.WorkstationLocked();
                  SendMessage(GetWindowHandle(), WM_COMMAND, APP_COMMAND_MEDIA_STOP, 0);
              }
             
              public override void WorkstationUnlocked()
              {
                  base.WorkstationUnlocked();
                  SendMessage(GetWindowHandle(), WM_COMMAND, APP_COMMAND_MEDIA_PLAY, 0);
              }
          }
      }

       
    • LESLIEx317537

      LESLIEx317537 - 2006-03-13

      Thanks Echostorm, code worked great with my new Winamp version.

       
    • LESLIEx317537

      LESLIEx317537 - 2006-03-15

      Actually I found a small issue while testing my monitor power on function.

      If Winamp is open and no songs are in the playlist and it tries to play, it will open up a dialog to ask you to play.
      - If this happens, for some reason my display function won't power on the monitor automatically then.

       

Log in to post a comment.

MongoDB Logo MongoDB