• AnyStream is having some DRM issues currently, Netflix is not available in HD for the time being.
    Situations like this will always happen with AnyStream: streaming providers are continuously improving their countermeasures while we try to catch up, it's an ongoing cat-and-mouse game. Please be patient and don't flood our support or forum with requests, we are working on it 24/7 to get it resolved. Thank you.

Reclocks RunEvent.vbs

sewe

Member
Thread Starter
Joined
Mar 18, 2008
Messages
13
Likes
0
Has anyone here get it to work with runevent.vbs, I can´t get it to work, all mpc does is "thinking" powerstrip starts.
Should be nice to get it to work so the program change refresh rate instead of me

Here is the script, anyone that see any wrong with it?

' -------------------------------------
' Event notification script for ReClock
' -------------------------------------
'
' This script will be called when ReClock change the media adaptation of a played file
' either automatically or after some manual change made in the properties panel
' It is called only for media file which contain a video stream, and when frame rate of this file is known
'
' ---------------------------------------------------------------------------------------------
' The 7 parameters received by this script are explained below:
'
' (1) contains the event name that just occurred:
' - "GREEN" : tray icon just got green (all is fine). Parameter
' - "YELLOW" : tray icon just got yellow. We should make what is necessary
' to change the monitor refresh rate
' - "STOP" : playback just stopped
' - "QUIT" : ReClock is about to quit
'
' Parameters (2), (3), (8) and (9) apply only with "GREEN" and "YELLOW" events. Otherwise they contain "-"
'
' (2) contains the type of media file currently played :
' - "CINEMA" : frame rate of source file is around 24 fps
' - "PAL" : frame rate of source file is around 25 fps
' - "NTSC" : frame rate of source file is around 30 fps
' - "CUSTOM" : frame rate of source file does not fall in previous categories
'
' (3) contains the current sound playback mode (apply only with GREEN/YELLOW event):
' - "PCM" : PCM mode
' - "SPDIF" : AC3 passthrough SPDIF
'
' (4) contains the current monitor selected for playback (1=primary, 2=secondary, etc...)
'
' (5) contains the total monitor count detected in the system
'
' (6) contains the current resolution of your monitor (WIDTHxHEIGHT)
'
' (7) contains the current refresh rate of your monitor (in Hz)
'
' (8) contains the original playback rate of the file (in fps multiplied by 1000)
'
' (9) contains the current playback rate of the file (in fps multiplied by 1000)
'
' (10) contains the filename of the current media file
'
' ---------------------------------------------------------------------------------------------
' Notifications examples:
' - GREEN CINEMA PCM 1 1 1024x768 72 23976 24000 c:\test.avi : all is good
' - GREEN NTSC PCM 1 1 1024x768 60 29970 30000 c:\test.avi : all is good
' - YELLOW PAL SPDIF 1 1 1024x768 72 25000 25000 c:\test.avi : please switch to a multiple of 25 hz since PAL wants 25 fps
' - YELLOW CINEMA SPDIF 1 1 1024x768 75 23976 23976 c:\test.avi : please switch to 71.928 hz
'
' ---------------------------------------------------------------------------------------------
' Here is a sample in VbScript that will call Powerstrip to change the monitor refresh rate
' using the /T parameter (to obtain the timings parameters go to the timings setup in powerstrip and copy
' them to the clipboard)
' There is a VERY important thing to note. Powerstrip change the timings directly in the hardware, but
' forget to notify Windows applications it did that (including ReClock). So this script MUST exit with
' an exit code of 0 if it did change the configuration with powerstrip. Otherwise the script should
' return 1

' Decode the parameters
Set objArgs = WScript.Arguments
If objArgs.Count < 10 Then
MsgBox "Bad argument count !", MB_OK, "ReClock Event Notification"

' We have done nothing. Return 1 to indicate ReClock that
' the configuration has not changed
WScript.Quit 1
End If

eventName = objArgs(0)
mediaType = objArgs(1)
soundMode = objArgs(2)
currentMonitor = objArgs(3)
totalMonitorCount = objArgs(4)
currentResolution = objArgs(5)
currentRefreshRate = objArgs(6)
originalPlaybackSpeed = objArgs(7)
currentPlaybackSpeed = objArgs(8)
currentMediaFile = objArgs(9)

' If you need to debug, replace false with true in the following line
if false Then MsgBox _
eventName & " " & _
mediaType & " " & _
soundMode & " " & _
currentMonitor & " " & _
totalMonitorCount & " " & _
currentResolution & " " & _
currentRefreshRate & " " & _
originalPlaybackSpeed & " " & _
currentPlaybackSpeed, _
MB_OK, "ReClock Event Notification"

' Here is a sample of what can be done with PowerStrip
Set wshShell = CreateObject("WScript.Shell")

' We will put new timings here if necessary
newTimings = ""

' Obviously we have something to do only if the icon is yellow
If eventName = "YELLOW" Then

' Call the profile that match best what we need in PCM mode
Select Case mediaType & ":" & currentResolution
Case "CINEMA:1920x1080"
If currentRefreshRate <> "48" Then newTimings = "1920,523,44,147,1080,10,5,38,143100,768" ' 47.952Hz

Case "PAL:1920x1080"
If currentRefreshRate <> "50" Then newTimings= "1920,528,44,148,1080,4,5,36,148500,768" ' 50Hz

Case "NTSC:1920x1080"
If currentRefreshRate <> "60" Then newTimings= "1920,88,42,148,1080,18,6,36,150187,770" ' 59.94Hz

Case "CUSTOM:1920x1080"
If originalPlaybackSpeed > 58000 AND originalPlaybackSpeed < 62000 Then
If currentRefreshRate <> "60" Then newTimings= "1920,88,42,148,1080,18,6,36,150187,770" ' 59.94Hz

ElseIf originalPlaybackSpeed > 48000 AND originalPlaybackSpeed < 52000 Then
If currentRefreshRate <> "50" Then newTimings= "1920,528,44,148,1080,4,5,36,148500,768" ' 50Hz
End if

End Select

End If

' We quit the player, restore our favorite refresh rate and/or resolution
If eventName = "STOP" Then

Select Case currentResolution
Case "1920x1080"
If currentRefreshRate <> "50" Then newTimings= "1920,528,44,148,1080,4,5,36,148500,768" ' 50Hz
End Select

End If

' Do we have new timings to apply ?
If newTimings <> "" Then

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(&H26&)
Set objFolderItem = objFolder.Self

' We will call Powerstrip 2 times
' In the second call, we will ask Powerstrip to change refresh rate/resolution
' and wait for it to finish the job. If Powerstrip would not be launched before, it would not
' return from this call leaving this VBS script stuck. That's why we make this first call to
' make sure that it is actually available (but we launch it only if it's not already running)
'Do While Not wshShell.AppActivate ("pstrip") ' it has a hidden window called with this name
' WshShell.Run """" & objFolderItem.Path & _
' "\PowerStrip\pstrip.exe"""
' WScript.Sleep(2000)
'Loop

' Now run Powerstrip command and wait for it to finish its job
WshShell.Run """" & objFolderItem.Path & _
"\PowerStrip\pstrip.exe"" /TARGET:" & currentMonitor & _
" /T:" & newTimings, 0, true

' In case we did a configuration change we MUST return 0 to
' indicate ReClock it need to recalibrate itself.
' However, I found no way to check that Powerstrip did the job correctly ...
WScript.Quit 0

End If

' We have done nothing. Return 1 to indicate ReClock that
' the configuration has not changed
WScript.Quit 1
 
Last edited:
It looks OK although you'll appreciate it is hard to make sure every dot and dash is in the right place!

Have you have enabled scripting in Reclock's advanced options?

Are you are running XP?

What graphics card do you have?

Is Powerstrip already running? (I see you have commented out the bit that checks and loads it if it is not).

Have you tried turning on debugging in Reclock and check what is happening? Is the script being called? Do the parameters look right?
 
So weird, it works now and I have know idea why:confused:
 
If you would like to check for pstrip running, but don't want video to be minimised in "3D"/"exclusive" mode then replace the relevant part of the script with this code:

Code:
' Do we have new timings to apply ?
If newTimings <> "" Then

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(&H26&) 
    Set objFolderItem = objFolder.Self
    Set locator = CreateObject("WbemScripting.SWbemLocator")
    Set service = locator.ConnectServer()
    Set props = service.ExecQuery("select name, description from Win32_Process where name = 'pstrip.exe'")
   

    ' We will call Powerstrip 2 times
    ' In the second call, we will ask Powerstrip to change refresh rate/resolution 
    ' and wait for it to finish the job. If Powerstrip would not be launched before, it would not
    ' return from this call leaving this VBS script stuck. That's why we make this first call to 
    ' make sure that it is actually available (but we launch it only if it's not already running)
    Do While props.Count = 0  ' if so pstrip not running
        WshShell.Run """" & objFolderItem.Path  & _
                     "\PowerStrip\pstrip.exe"""
        WScript.Sleep(2000)
        Set props = service.ExecQuery("select name, description from Win32_Process where name = 'pstrip.exe'")
    Loop
 
Back
Top