----- 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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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);
}
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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);
}
}
}
Thanks Echostorm, code worked great with my new Winamp version.
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.