INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Script to wake computer, open MC and start playback (alarm clock)  (Read 27402 times)

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers

Here are a couple of batch files that along with Windows Task Scheduler allow you to wake the computer from sleep/standby or hibernation.
I created this as a substitute for the built in scheduler since as far as I can tell it is limited in what you can do and a script allows you to use far more variables.
For reasons beyond my knowledge this has to be done with 2 separate scripts 1 to open MC and 2 to send commands through MCxx.exe
If it is all combined into a single script W.T.S. loads MCxx.exe as an always running app instead of just using it as a command handler which cause MC to hang.
The scripts are a hybrid script with a bit of standard batch and a bit of VBScript.

Batch 1 (MCwake.bat) for 32bit system move "rem" to the "PROGRA~2 line

@echo on
rem Start C:\PROGRA~1\JRiver~1\MEDIAC~1\MEDIAC~1.EXE
Start C:\PROGRA~2\JRiver~1\MEDIAC~2\MEDIAC~1.EXE
timeout /t 5 /nobreak > NUL
Start D:\MCplay.bat
exit


Batch 2 (MCplay.bat)

@echo on
SetLocal EnableDelayedExpansion
:Start
rem is for remarks
rem this line is used to set the volume of MC after start up, the integer is %

MC15.exe /Command VolumeSet 10
rem if you wish to play the current playing now list leave as is if you wish to specify a file/files to play move the rem to the MCC 10001 line and enter the path to the file/files you wish to use
rem MC15.exe D:\Music\Pink Floyd\The Dark Side Of The Moon\Pink Floyd - The Dark Side Of The Moon - 03 - Time.mp3
MC15.exe /MCC 10001

if exist "%temp%\Cancel.txt" del "%temp%\Cancel.txt"
if exist "%temp%\Snooze.txt" del "%temp%\Snooze.txt"

echo>  "%temp%\Alarm.vbs" Set oFSO = CreateObject("Scripting.FileSystemObject")
echo>> "%temp%\Alarm.vbs" If MsgBox("Click OK to snooze, Cancel to exit", 1, "Alarm clock") = vbCancel _
echo>> "%temp%\Alarm.vbs" Then oFSO.CreateTextFile WScript.Arguments(0) ^& "\Cancel.txt", true _
echo>> "%temp%\Alarm.vbs" Else oFSO.CreateTextFile WScript.Arguments(0) ^& "\Snooze.txt", true
start /b "Popup" wscript.exe "%temp%\Alarm.vbs" "%temp%"

rem the below section sets volume increase and interval
rem to change max volume change LEQ 50 (50%) to LEQ xx
rem to change the volume increase per step change VolumeUp 10 to VolumeUp xx
rem to change the interval change /t 5 to /t x

set Vol=10
:Loop
  set /a Vol=!Vol! + 10
  if !Vol! LEQ 50 MC15.exe /Command VolumeUp 10
  timeout /t 5 /nobreak > NUL
  if exist "%temp%\Cancel.txt" exit
  if exist "%temp%\Snooze.txt" (
    MC15.exe /Command Stop
rem change /t 300 to whatever you wish this is the length of time for snooze in seconds
    timeout /t 300 /nobreak > NUL
    goto Start
  )
  goto Loop
)

After the batch starts it will open an explorer pop up like below

if you chose "OK" the script will stop playback for the amount of time you set in the line just before "goto start"
and then restart, if you chose cancel the script will terminate and continue playback.
If you don't want to have the cmd window show the text for the executions change @echo on to @echo off
if you don't want the command window visible at all use hstart
You can either copy and paste the scripts above into 2 separate .bat files or download them along with hstart here
Logged
Sean

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers
Re: Script to wake computer, open MC and start playback (alarm clock)
« Reply #1 on: January 23, 2011, 10:33:43 pm »

Forgot to mention if you wish to edit which I am sure most will right click the batch file and select edit this will open the file in your default text editor generally notepad.

If you are on either Vista or Win 7 to open Task Scheduler go to Start and just type task in the search and it will show up.
If Win XP it is in Start-->All Programs-->Accessories-->System Tools-->Scheduled Tasks.
Once you are in TS it is pretty self explanatory but if you need help don't hesitate to ask and I will do what I can.
Logged
Sean
Pages: [1]   Go Up