Win Hoping a Genius Can Make a Shortcut
#16
@a11599
Turned on PC this morning and when it boots to desktop, rate changes to 24Hz with no interaction. It should be at 60Hz. I can click the .bat to set it back to 60Hz. Rebooting does the same thing. Thought it odd it switches without clicking the .bat. Found nothing in task manager or start up so I did a restore point. Booted and rebooted to 60Hz like it should. Ran the .bat and switched it a couple times. It drops a file '24.hz' in the folder. Rebooted and it went to 24Hz. Edited everything that was 24 to 60 in the .bat and vice versa. Rebooted. Still changing to 24Hz. Would you be willing to adjust your code for me? Sorry to be bothersome. Doing another system restore point now. I should add, that even though the RefreshRateChanger folder resides in the Documents folder, nothing is wrong at boot. It's only once I click the .bat and reboot that the rate change goes wrong.
HOW TO - Kodi 2D - 3D - UHD (4k) HDR Guide Internal & External Players iso menus
DIY HOME THEATER WIND EFFECT

W11 Pro 24H2 MPC-BE\HC madVR KODI 22 GTX960-4GB/RGB 4:4:4/Desktop 60Hz 8bit Video Matched Refresh rates 23,24,50,60Hz 8/10/12bit/Samsung 82" Q90R Denon S720W
Reply
#17
Try this one:

Code:
@echo off
setlocal EnableDelayedExpansion

set cmd=""%~dp0QRes.exe" /s |find "60 Hz""
for /f %%a in ('!cmd!') do set is60hz=%%a
if "%is60hz%" neq "" goto :hz24
set cmd=""%~dp0QRes.exe" /s |find "59 Hz""
for /f %%a in ('!cmd!') do set is60hz=%%a
if "%is60hz%" neq "" goto :hz24

echo Setting 60 Hz
"%~dp0QRes.exe" /r:60 /d
goto :eof

:hz24
echo Setting 24 Hz
"%~dp0QRes.exe" /r:24 /d

This will instruct QRes to not save the refresh change in the registry. It will also detect the current refresh rate instead of relying on the 24.hz file.
Reply
#18
This is one isn't working. Flashes CMD, panel flashes, but doesn't switch. Tried repeatedly. Fwiw, searched QRes in regedit and found no instances. So, restore did take them out.
HOW TO - Kodi 2D - 3D - UHD (4k) HDR Guide Internal & External Players iso menus
DIY HOME THEATER WIND EFFECT

W11 Pro 24H2 MPC-BE\HC madVR KODI 22 GTX960-4GB/RGB 4:4:4/Desktop 60Hz 8bit Video Matched Refresh rates 23,24,50,60Hz 8/10/12bit/Samsung 82" Q90R Denon S720W
Reply
#19
Let's make another try with the JScript version. Batch files can be a bitch sometimes. Smile I uploaded switch.js here: http://subvoice.hu/xbmc/switch.js so you will not have the character encoding issue. Place it into the same folder as QRes and let me know how it works.
Reply
#20
Not working at all. No CMD, no panel flash, nothing. Will anything write to registry using this?

Maybe this?

shell.Run(fs.GetAbsolutePathName(fs.BuildPath(fs.GetParentFolderName(WScrip​t.ScriptFullName), 'QRes.exe')) + ' /r:' + (refreshRate == 60 ? 24 : 60), 0, true);

vs.

shell.Run(fs.GetAbsolutePathName(fs.BuildPath(fs.GetParentFolderName(WScript.ScriptFullName), 'QRes.exe')) + ' /d /r:' + (refreshRate >= 59 ? 24 : 60), 0, true);


Ok. I did edit that line and it's working. Rebooted twice to make sure and desktop always goes to 60Hz as it should. Also confirmed that Kodi 'Match Refresh Rate' still auto switches and is unaffected. Also confirmed that mirrors to other HDMI inputs are unaffected and operable using this. 2 minor things that are so minor, I don't even want to bother you with them. I have to double click it 2 times, 4 in total to work. The 1st double click, the panel flashes to black but remains at 60Hz and I suspect it's querying current state. The 2nd double click, panel flashes to black and switches. It does write to registry a handful of times so, it remembers last state and boots to that last state.
Thanks for that upload. You're awesome.
HOW TO - Kodi 2D - 3D - UHD (4k) HDR Guide Internal & External Players iso menus
DIY HOME THEATER WIND EFFECT

W11 Pro 24H2 MPC-BE\HC madVR KODI 22 GTX960-4GB/RGB 4:4:4/Desktop 60Hz 8bit Video Matched Refresh rates 23,24,50,60Hz 8/10/12bit/Samsung 82" Q90R Denon S720W
Reply
#21
Okay, it turns out your system does not support the /d switch of QRes.exe.

Try this one, hopefully it will get rid of the need for having to start twice:

shell.Run(fs.GetAbsolutePathName(fs.BuildPath(fs.GetParentFolderName(WScript.Scr​iptFullName), 'QRes.exe')) + ' /r:' + (refreshRate >= 59 ? 24 : 60), 0, true);

Windows 8 has a habit to set 59 Hz if you request 60 Hz.
Reply
#22
You are exactly correct. There have been times in the past I noticed windows had set to 59Hz but I noticed no difference in the render. I don't know what prompted it to do this? Never knew it was even at this setting until by chance looked in properties. It's been some time since it's done it though. I'm on 8.1 not 8 if that makes a difference? I was using dual monitors at different resolutions back then though. I think that's what confused Windows?

Replacing the "60" with a "59" and replacing the "=" with a ">" and removing the "/d" in that line made no difference.

Could it be because we are omitting /x 1920 /y 1080 ?

Once again, you've already extended yourself to at least one person in this community above and beyond. I don't want to use you up but know your efforts are greatly appreciated and you've already earned the 'Genius' title in my eyes. Thank you for your dedication.

Went ahead and added this line.

shell.Run(fs.GetAbsolutePathName(fs.BuildPath(fs.GetParentFolderName(WScript.ScriptFullName), 'QRes.exe')) + ' /x 1920 /y 1080 /r:' + (refreshRate >= 59 ? 24 : 60), 0,

All is perfect I think? I'll post back if I find any adverse affects. So far I used it, rebooted and it went to 60Hz as it should. Used again a few times and it's quick. I took it one step further. I added a quick launch tool bar to W8.1 and linked the .js. One click for the switch now. One click to switch back. I don't think it can get any more perfect using this script. I notice the batch file has the /d and no 1920 1080 reference. If those were edited in your .bat, perhaps it wouldn't write to registry and clean up this whole hack? Meaning the part of remembering the last used state. I'll give you an example why this is important. In Kodi you have match refresh rate enabled. You're watching a 24FPS title and your panel is @24Hz because Kodi switched it as it should. You turn off your PC without stopping the playback, let alone quit Kodi. I do this often. Next reboot, the registry is going to remember that last 24Hz state and that's what you're going to boot to. Feel like editing your .bat knowing what we know from the above .js?
HOW TO - Kodi 2D - 3D - UHD (4k) HDR Guide Internal & External Players iso menus
DIY HOME THEATER WIND EFFECT

W11 Pro 24H2 MPC-BE\HC madVR KODI 22 GTX960-4GB/RGB 4:4:4/Desktop 60Hz 8bit Video Matched Refresh rates 23,24,50,60Hz 8/10/12bit/Samsung 82" Q90R Denon S720W
Reply
#23
Windows switching to 59 Hz instead of 60 Hz is a known behavior of Windows 8 and as an end user there is nothing you can do about it. It creates a lot of problems for HTPC use (also for Kodi) but Microsoft sees this as a feature and not a bug. Forget the .bat files. The .js solution is better (no flashing command window, better control on what's happening - .bat is very hacky).

I had a similar situation before as your mentioned use case. The only workaround I found was to have a script in startup. Try http://www.subvoice.hu/xbmc/60hz.js in autostart. This will detect whether your current refresh rate is below 59 Hz and will switch to 60 Hz. Depending on the speed of your computer the switch will happen in a few seconds after boot (much better with SSD). Unfortunately I have not found a way to restore the resolution before shutdown.
Reply

Logout Mark Read Team Forum Stats Members Help
Hoping a Genius Can Make a Shortcut0