What's new

This is a Guide on how to Auto pause Media at Workstation lock (Includes Browser).

Johncoool

Member
There are several ways to lock the computer. It does not require a password to do so. This can be used to pause video playback on several media players including the Google Chrome Browser (Version 85.0.4183.121) in combination with this guide. It has not been tested on other Browsers but it might work the same as well. The method works well with Windows 8.1 and Windows 10 and could also work with Windows 7 but has not been tested on it due to lack of availability.

All quotes should not be used while typing the same commands.

Locking Windows can be triggered by the following ways.
  • In screensaver settings, Check the “On Resume, Display logon screen”
  • The Windows + L will trigger the Workstation lock.
  • Running the following from Run command or from command line will trigger the Workstation Lock “rundll32.exe user32.dll,LockWorkStation”. It can also be saved in a batch file script and every time it is run it will lock the PC.
  • From the power menu options in the start menu.
Media player pause on Workstation lock.

There are two existing media players which lock automatically at Workstation lock and automatically Resume at Workstation Unlock. The below are details and links to download them. (They are the latest version of Windows classic player).

Download links:

MPC-HC: Home · MPC-HC

MPC-BE: MPC-BE

They look very similar with some differences and some different features. MPC-BE views all frames on the timeline like is done on YouTube. I use them sometimes when VLC uses a lot of CPU while decoding a video. They seem to use less CPU power but they do not decode all media types.

To pause other players at lock Screen then it will be required to use a tool with Windows Task Scheduler (Default Windows program).

The program will Pause only one of the running instances. VLC has an option to run several videos in different windows at the same time. The tool will work to only pause one of them at Workstation lock. It can also be made into a batch file script to pause it every time it runs.

Download link (Click on code then Download Zip): ConstantJoe/LumaBandAppController

It contains several tools. Just extract the “CLMControl.exe” and move it to C:\Windows\System32 folder.

After doing that you can view all the commands for this tool by opening CMD and typing "CLMControl" or "CLMControl /?".

To set up the auto pause on Workstation lock:

Open Task Scheduler and create a folder under the main one and name it something like Media, then create a new task, name the task something related to the required job. In the "Triggers" tab click on new and then change the option from the drop down menu to “On workstation lock” .

On the "Actions" tab, click on new and do the same as below.

1.PNG

This is only for the pause command.

In place of VLC you can add the name of the process of other media players. It works with most Media Players (It did not work with my audio player). To get the process name, open Task manager and go to the details tab and find the process there but do not include the “.exe”

You can add more media players to be paused by just clicking on “New” under the “Actions” tab and adding others. Just replace the VLC with name of the other process name.

Under “Conditions” tab Uncheck the “Start the task only if the Computer is on AC power” for laptops and tablets.

Tasks can also be created to resume on Workstation Unlock by creating a new task and following the same way with making the needed changes and getting the other commands as mentioned previously.

Pause Browser Media playback on Workstation Lock.

This will require the AutoHotkey program with an AHK script.

Download link: AutoHotkey

To create the AHK script open a text file and add the below script to it. After it is saved, close it and change the extension from “.txt” to “.ahk”. AHK files can be edited by right click on it and open with Notepad.

After installing the Autohotkey program it will create several exe files that can be associated with the AHK file. Not all will work with the commands. From my own experience I had to try each one until I found the one compatible with the script. The exe file will be located in the default location of the installed program. To test the AHK script. Right click on it and choose open with and go to the directory of the install location of AutoHotkey program and try it with each one until one works for you then choose it as a default. A folder in the same location called compiler has a converter that will convert the AHK to a standalone exe program (it will also need to be tested for each type of the AutoHotkey types). It is not required to convert the AHK to exe as long as it is set up correctly. Next just add the working AHK or EXE file that has the working script to the windows startup folder so that the script will start at Windows boot up. You will get a tray icon for the program.

The script will pause one of the running videos in one of the tabs (it will also close the PIP window) It has worked with all the Media sites that I have tested. It will work well as long as you only have one active Media running in one of the tabs.

Refer to the below link to view all symbols used for AutoHotkey:

Hotkeys - Definition & Usage | AutoHotkey

Don’t include spaces for the key combinations or + signs between them unless it is part of the symbols.

The script is using the Windows with L (small case or caps) key which is the combination used to lock Windows. So it will do two things at the same time. It will lock the PC and pause running media in one of the tabs. The tab does not have to be open or the active one for it to be paused as long as it has media running on it it will be paused.

The Script:

#L::
IfWinExist ahk_class Chrome_WidgetWin_1
{
WinActivate
Send {Media_Stop}
}


2.PNG

I added the Image from my script to show that you need to press on tab to create the space before the code for lines 4 and 5.

To try for other browsers then search internet for AutoHotkey or in their Forum to replace this line "IfWinExist ahk_class Chrome_WidgetWin_1".

To enable other key combination of the same script you can use it again but just change it before the "::"

If it affecting the installed media players then go to the option of the media player and remove all hotkey controls for "Media_Stop" which might be under normal and global or App_command.

None of the tested have been done on UWP programs. They have only been tested on programs that are not installed from the Windows store.

After completing all the above. Pressing on Windows with L buttons the system will pause the media playback in Chrome and any media players you have added to the tasks at the same time while also locking the system.
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    Laptop
    System Manufacturer/Model
    Lenovo G50-80
    CPU
    I3 1.7GHz
    Memory
    12GB
    Graphics Card(s)
    Intel
    Antivirus
    Free-AVG

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top