Change screen resolution when game is launched and switch back on exit
Change screen resolution when game is launched and switch back on exit
Hi.
I want to run and emulator and game in a specific resolution. Rather than changing the resolution in my graphic settings every time I would like help with a script.
I want to change the resolution on launch of the emulator and game and then change it back on the press of a specific key (Esc)
The example command prompt is as per below.
TeknoParrotUi -profile=ID7.xml
It then opens a specific game exe e.g. Lgi.exe based on the profile above.
To exit emulation it's the escape key so that's the trigger to change the resolution back.
Can you help. Lots of games will only work in custom resolutions so if I can get a script working it would be extremely helpful.
Unfortunately the emulator only supports either window or full screen (current resolution) so it doesn't automatically switch to the correct native resolution which is a pain.
I want to run and emulator and game in a specific resolution. Rather than changing the resolution in my graphic settings every time I would like help with a script.
I want to change the resolution on launch of the emulator and game and then change it back on the press of a specific key (Esc)
The example command prompt is as per below.
TeknoParrotUi -profile=ID7.xml
It then opens a specific game exe e.g. Lgi.exe based on the profile above.
To exit emulation it's the escape key so that's the trigger to change the resolution back.
Can you help. Lots of games will only work in custom resolutions so if I can get a script working it would be extremely helpful.
Unfortunately the emulator only supports either window or full screen (current resolution) so it doesn't automatically switch to the correct native resolution which is a pain.
Re: Change screen resolution when game is launched and switch back on exit
I am also interested in a script like this. I am trying to build one right now. Just to be clear chisino you want a script to perform the following:
1) Change desktop resolution
2) Launch game
3) when Escape is pressed to exit the game
4) Revert resolution back to previous desktop resolution
Do I understand this correctly?
1) Change desktop resolution
2) Launch game
3) when Escape is pressed to exit the game
4) Revert resolution back to previous desktop resolution
Do I understand this correctly?
Re: Change screen resolution when game is launched and switch back on exit
I built a script this morning. I found a tiny program that allows changing the resolution from the Windows command line. You can obtain and read more about it at the links below. Furthermore, typing qres /? in a command window lists additional QRes switches that aren't documented in the QRes help file. Copy it into the C:\Windows\System32\ directory to be able to use the command anywhere, regardless of the active directory. You will need to change the resolutions and program executable for your own needs, but I imagine this will work well for you too. Let me know if you have any questions
QRes Webpage
QRes Download (SourceForge, uncompiled)
QRes Download (MajorGeeks, compiled)
QRes Command Line Switch List (image)
QRes Commands, A Few Additional Mentioned
Note: I compiled the script into an EXE file and run it on my desktop just like a normal file shortcut. Outside of running this game the script has no reason to be running, so I added the ExitApp line. Should you want to add this to a larger script, you will need to remove the ExitApp line and add a hotkey trigger directly above the RunWait line on Line 6.
QRes Webpage
QRes Download (SourceForge, uncompiled)
QRes Download (MajorGeeks, compiled)
QRes Command Line Switch List (image)
QRes Commands, A Few Additional Mentioned
Code: Select all
#SingleInstance force
DetectHiddenWindows, On
;Allows you to hide the CMD window. If you won't be hiding your CMD window, then no need to add this line.
RunWait, %ComSpec% /c qres /c:32 /r:0 /x 1600 /y 1200,,Hide,change_res
;Utilizes qres.exe program to change the desktop resolution utilizing CMD.exe
;Will wait for the command window to terminate before proceeding any further. Use Run instead if you prefer not to wait.
;%ComSpec% is equivalent to utilizing "cmd.exe" from the Windows System32 directory.
;/C = Carries out the command specified by string and then terminates the CMD window
;,Hide, = hide the CMD window. If you prefer to see the CMD window executing, change ",Hide," to ",,"
;/r:0 Changes the refresh rate to Adapter Default (QRes)
;/r:-1 Changes the refresh rate to Optimal (QRes)
;/r:80 Changes the refresh rate to 80 Hz (QRes)
;/c:8 Changes color resolution to 256 colors (QRes)
;/c:16 Changes color resolution to high color (16 bit) (QRes)
;/c:24 Changes color resolution to true color (24 bit) (QRes)
;/c:32 Changes color resolution to true color (32 bit) (QRes)
; Qres Webpage
; http://qres.sourceforge.net/
; QRes Command Line Switch List (image)
; https://i.postimg.cc/wvfLQYxW/qres-switches.png
; QRes Commands, A Few Additional Mentioned
; https://www.autohotkey.com/board/topic/53228-cmd-qres-screen-resolution-color-depth-refresh-rate/
; QRes Download (uncompiled)
; https://sourceforge.net/projects/qres/
; Download QRes v1.1 (compiled)
; https://www.majorgeeks.com/files/details/qres.html
; Note: Sourceforge has a multi-file and folder uncompiled version. Search the web for the compiled v1.1 version and place it in "C:\Windows\System32\" directory. Typing "qres" in a CMD window will return a result, as seen here: https://i.postimg.cc/RFqkH0VG/qres-cmd-window.png
Run, C:\Program Files (x86)\Steam\steamapps\common\Spectromancer\spectromancer.exe,,,
;Start the game of my choice. Note that if a parameter contains spaces, it is safest to enclose it in double quotes (even though it may work without them in some cases). See https://www.autohotkey.com/docs/commands/Run.htm for additional information.
Return ; No further action needed at this time. Script will continue when key combination to close program is triggered.
~Escape:: ; Terminate the game by double-pressing Escape
if (A_PriorHotkey != "~Escape" or A_TimeSincePriorHotkey > 400)
{
KeyWait, Escape ; waiting for Escape to be pressed a second time within a 400ms of initial press
return
}
if WinExist("ahk_exe Spectromancer.exe") ; check if desired game executable is running before terminating it
{
; Terminate the window found above
WinClose
GoSub, Restore_Resolution
Return
}
else
{
MsgBox, The executible specified isn't running.
GoSub, Restore_Resolution
Return
}
Restore_Resolution:
Run, %ComSpec% /c qres /c:32 /r:75 /x 2560 /y 1440,,Hide,change_res ; Restore desktop resolution back to normal
ExitApp ; Exits the script entirely. Remove this line if you don't want that to happen.
Last edited by Mulsiphix on 27 Apr 2022, 23:25, edited 3 times in total.
-
- Posts: 37
- Joined: 26 Apr 2022, 20:34
Re: Change screen resolution when game is launched and switch back on exit
I'm very new and trying to understand how to make this work. I installed qres through cmd. can you give me a example of %comspec%? What did you put there? Heres the ahk I'm Trying to run:
[Mod edit: [code][/code] tags added.]
It works except I need to change the res to 1080 and then back to 2160 when it closes. Could you or anybody show me what I need to add to the ahk to make qres do this? It would really help me out a lot. Once I have one example I can apply it to the few other games I need. I know Its already been done in the post but its like reading a different language haha. I'm hoping for you or someone to dumb it down a little for me. Thanks
Code: Select all
#SingleInstance force
Run, TeknoParrotUi.exe --profile=Luigismansion.xml
Esc::
Process,Close,TeknoParrotUi.exe
Run,taskkill /im "TeknoParrotUi.exe" /F
ExitApp
Return
It works except I need to change the res to 1080 and then back to 2160 when it closes. Could you or anybody show me what I need to add to the ahk to make qres do this? It would really help me out a lot. Once I have one example I can apply it to the few other games I need. I know Its already been done in the post but its like reading a different language haha. I'm hoping for you or someone to dumb it down a little for me. Thanks
Re: Change screen resolution when game is launched and switch back on exit
I recommend using my script above and just changing the parameters you need. I tried to document everything you might need in the script comments. I do not mind updating the script for you. But I need some additional information.
RunWait, %ComSpec% /c qres /c:32 /r:0 /x 1600 /y 1200,,Hide,change_res
and another
Run, %ComSpec% /c qres /c:32 /r:75 /x 2560 /y 1440,,Hide,change_res
- What is the exact path on your system to TeknoParrotUi.exe? I will need the full path.
- My script requires that you double-press Escape. Many games ustilize the Escape key in the menu's. If you set a single press of Escape to exit the program, it might interfere with TeknoParrotUi's native keys. If you prefer a single keypress, I can update the script to not utilize a double-press of Escape. Which do you prefer, single or double-press?
- You mention the resolution 1080 and then 2160. Can you give me the full resolution please? For example, 1280 x 720. I need both full resolutions for qres.
RunWait, %ComSpec% /c qres /c:32 /r:0 /x 1600 /y 1200,,Hide,change_res
and another
Run, %ComSpec% /c qres /c:32 /r:75 /x 2560 /y 1440,,Hide,change_res
-
- Posts: 37
- Joined: 26 Apr 2022, 20:34
Re: Change screen resolution when game is launched and switch back on exit
1. That is the exact path. I have the ahk located on my desktop along with teknoparrot. I got teknoparrot to launch already with the ahk. I just want to make sure qres is working properly.
2. Single press escape is fine for my use
3.Resolution on my pc is 3840x2160 and I want it to switch to 1920x1080 when teknoparrot is launched and when it closes to go back to 3840x2160
Here's what I came up with just not sure if its doing want I need it to because I'm testing it on a different pc that doesn't run at those resolutions so I'm trying to use different resolutions but I can't tell a difference in game if its changing my pc res or not. I may just try it on the actual pc that I want to use it on to see if it works. It launches the game fine just not sure if the resolution is changing:
[Mod edit: [code][/code] tags added.]
2. Single press escape is fine for my use
3.Resolution on my pc is 3840x2160 and I want it to switch to 1920x1080 when teknoparrot is launched and when it closes to go back to 3840x2160
Here's what I came up with just not sure if its doing want I need it to because I'm testing it on a different pc that doesn't run at those resolutions so I'm trying to use different resolutions but I can't tell a difference in game if its changing my pc res or not. I may just try it on the actual pc that I want to use it on to see if it works. It launches the game fine just not sure if the resolution is changing:
Code: Select all
#SingleInstance force
Run, C:\Windows\system32\cmd.exe /c qres /c:32 /r:0 /x 800 /y 600
Run, TeknoParrotUi.exe --profile=Luigismansion.xml
Esc::
Process,Close,TeknoParrotUi.exe
Run,taskkill /im "TeknoParrotUi.exe" /F
Process,Close,VACUUM.exe
Run,taskkill /im "VACUUM.exe" /F
Run, C:\Windows\system32\cmd.exe /c qres /c:32 /r:75 /x 1366 /y 768
ExitApp
return
Last edited by gregster on 27 Apr 2022, 13:06, edited 1 time in total.
Reason: Please use code tags. Thank you!
Reason: Please use code tags. Thank you!
-
- Posts: 37
- Joined: 26 Apr 2022, 20:34
Re: Change screen resolution when game is launched and switch back on exit
I know the resolutions on that need to be changed to the resolutions I stated above I just have them set as they are for testing on the pc I test new stuff on so I don't screw up anything on my main pc.
-
- Posts: 37
- Joined: 26 Apr 2022, 20:34
Re: Change screen resolution when game is launched and switch back on exit
It doesn't seem to be changing my pc resolution. I just manually changed it to see what it would like like at 800x600 and it was totally different than when I use the ahk to change my pc resolution before the game launches.
Re: Change screen resolution when game is launched and switch back on exit
You can use qres itself to check your current resolution. Simply open a CMD window and type qres /s and it will show you the current monitor resolution. Launch the script and when TeknoParrotUi.exe is active, swap over to a CMD window and run the qres command to see if the resolution has changed.jimbone007 wrote: ↑27 Apr 2022, 14:11It doesn't seem to be changing my pc resolution. I just manually changed it to see what it would like like at 800x600 and it was totally different than when I use the ahk to change my pc resolution before the game launches.
Likewise, you can test qres outside of AHK by opening a CMD window and first trying to change the resolution. If there is any issue with qres changing the resolution, qres will provide an error of some sort. For example, when I tried running your resolution of 1366x768 on my own monitor, qres reported "Error: The graphics mode is not supported!". Open up a CMD window and try running both of these lines, exactly as they are written below. Do they work?
qres /c:32 /r:0 /x 800 /y 600
qres /c:32 /r:75 /x 1366 /y 768
- - - - - - - - - -
Based on what you have shared above, I modified the script I provided above with your information.
With Comments
Code: Select all
#SingleInstance force
DetectHiddenWindows, On
;Allows you to hide the CMD window. If you won't be hiding your CMD window, then no need to add this line.
RunWait, %ComSpec% /c qres /c:32 /r:0 /x 800 /y 600,,Hide,change_res
;Utilizes qres.exe program to change the desktop resolution utilizing CMD.exe
;Will wait for the command window to terminate before proceeding any further. Use Run instead if you prefer not to wait.
;%ComSpec% is equivalent to utilizing "cmd.exe" from the Windows System32 directory.
;/C = Carries out the command specified by string and then terminates the CMD window
;,Hide, = hide the CMD window. If you prefer to see the CMD window executing, change ",Hide," to ",,"
;/r:0 Changes the refresh rate to Adapter Default (QRes)
;/r:-1 Changes the refresh rate to Optimal (QRes)
;/r:80 Changes the refresh rate to 80 Hz (QRes)
;/c:8 Changes color resolution to 256 colors (QRes)
;/c:16 Changes color resolution to high color (16 bit) (QRes)
;/c:24 Changes color resolution to true color (24 bit) (QRes)
;/c:32 Changes color resolution to true color (32 bit) (QRes)
; Qres Webpage
; http://qres.sourceforge.net/
; QRes Command Line Switch List (image)
; https://i.postimg.cc/wvfLQYxW/qres-switches.png
; QRes Commands, A Few Additional Mentioned
; https://www.autohotkey.com/board/topic/53228-cmd-qres-screen-resolution-color-depth-refresh-rate/
; QRes Download (uncompiled)
; https://sourceforge.net/projects/qres/
; Download QRes v1.1 (compiled)
; https://www.majorgeeks.com/files/details/qres.html
; Sourceforge has a multi-file and folder uncompiled version. Search the web for the compiled v1.1 version and place it in "C:\Windows\System32\" directory. Typing "qres" in a CMD window will return a result, as seen here: https://i.postimg.cc/RFqkH0VG/qres-cmd-window.png
Run, TeknoParrotUi.exe --profile=Luigismansion.xml,,,
;Start the game of my choice. Note that if a parameter contains spaces, it is safest to enclose it in double quotes (even though it may work without them in some cases). See https://www.autohotkey.com/docs/commands/Run.htm for additional information.
Return ; No further action needed at this time. Script will continue when key combination to close program is triggered.
~Escape:: ; Terminate the game by single-pressing Escape
if WinExist("ahk_exe Spectromancer.exe") ; check if desired game executable is running before terminating it
{
; Terminate the window found above
Process,Close,TeknoParrotUi.exe
Run,taskkill /im "TeknoParrotUi.exe" /F
Process,Close,VACUUM.exe
Run,taskkill /im "VACUUM.exe" /F
GoSub, Restore_Resolution
Return
}
else
{
MsgBox, The executible specified isn't running.
GoSub, Restore_Resolution
Return
}
Restore_Resolution:
Run, %ComSpec% /c qres /c:32 /r:75 /x 1366 /y 768,,Hide,change_res ; Restore desktop resolution back to normal
ExitApp ; Exits the script entirely. Remove this line if you don't want that to happen.
Code: Select all
#SingleInstance force
DetectHiddenWindows, On
RunWait, %ComSpec% /c qres /c:32 /r:0 /x 800 /y 600,,Hide,change_res
Run, TeknoParrotUi.exe --profile=Luigismansion.xml,,,
Return
~Escape::
if WinExist("ahk_exe TeknoParrotUi.exe")
{
Process,Close,TeknoParrotUi.exe
Run,taskkill /im "TeknoParrotUi.exe" /F
Process,Close,VACUUM.exe
Run,taskkill /im "VACUUM.exe" /F
GoSub, Restore_Resolution
Return
}
else
{
MsgBox, The executible specified isn't running.
GoSub, Restore_Resolution
Return
}
Restore_Resolution:
Run, %ComSpec% /c qres /c:32 /r:75 /x 1366 /y 768,,Hide,change_res
ExitApp
Last edited by Mulsiphix on 27 Apr 2022, 23:19, edited 1 time in total.
-
- Posts: 37
- Joined: 26 Apr 2022, 20:34
Re: Change screen resolution when game is launched and switch back on exit
When I opened up CMD window and entered the line you said to it said :qres is not recognized as a internal or external command operable program or batch file
When I tried to enter the path to qres.exe then entered /x:800 /y: 600 a qres window popped up and said Unknown option x
So it seems like Its not working for some reason. how should I proceed? Thanks for writing those scripts and helping me out by the way. I feel like if I get qres to work and switch my pcs res I'll have everything I need
When I tried to enter the path to qres.exe then entered /x:800 /y: 600 a qres window popped up and said Unknown option x
So it seems like Its not working for some reason. how should I proceed? Thanks for writing those scripts and helping me out by the way. I feel like if I get qres to work and switch my pcs res I'll have everything I need
-
- Posts: 37
- Joined: 26 Apr 2022, 20:34
Re: Change screen resolution when game is launched and switch back on exit
I also tried a batch file I found on the launchbox forum and altered it to fit my needs and when I launched it the game launched but I got a qres.exe system error that says: The code execution cannot proceed because the qres32.dll was not found. Reinstalling the program may fix this problem. Can you tell me how to install the qres.exe so I know I'm installing it properly?
Re: Change screen resolution when game is launched and switch back on exit
You are most welcomejimbone007 wrote: ↑27 Apr 2022, 20:05Thanks for writing those scripts and helping me out by the way.
It definitely seems like qres is not properly installed. Try downloading this version of QRes from MajorGeeks. It is just a single exe file, unlike the multi-file and folder sourceforge download. Place qres.exe into your C:\Windows\System32 directory. Open up a CMD window and type qres. If it responds like this, then it is properly installed
-
- Posts: 37
- Joined: 26 Apr 2022, 20:34
Re: Change screen resolution when game is launched and switch back on exit
Thank You so much. I got everything working. I installed qres the way you suggested. Then used your script and everything worked perfect. I also applied it to other emulators/ games I was having trouble with and then ran then compiled the scripts and ran them through the front end software bigbox and everything is working great!
Re: Change screen resolution when game is launched and switch back on exit
That is wonderful news! Congratulations
Re: Change screen resolution when game is launched and switch back on exit
HI:)
thanks for the script...i also try using it with teknoparrot.
the problem is that after i quit with esc...my default win res doesnt change back.
in the script i change it to: 1360x768 and want to change back to 1920x1080 after i quit.
what am i doing wrong?
[Mod edit: [code][/code] tags added.]
thanks for the script...i also try using it with teknoparrot.
the problem is that after i quit with esc...my default win res doesnt change back.
in the script i change it to: 1360x768 and want to change back to 1920x1080 after i quit.
what am i doing wrong?
Code: Select all
#SingleInstance force
DetectHiddenWindows, On
RunWait, %ComSpec% /c qres /c:32 /r:0 /x 1360 /y 768,,Hide,change_res
SetWorkingDir ,D:\emulators\teknoparrot_Guns
run, TeknoParrotUi.exe --profile=terminator.xml,,,
Return
~Escape::
if WinExist("ahk_exe TeknoParrotUi.exe")
{
Process,Close,TeknoParrotUi.exe
Run,taskkill /im "TeknoParrotUi.exe" /F
GoSub, Restore_Resolution
Return
}
else
{
MsgBox, The executible specified isn't running.
GoSub, Restore_Resolution
Return
}
Restore_Resolution:
Run, %ComSpec% /c qres /c:32 /r:75 /x 1920 /y 1080,,Hide,change_res
ExitApp
Re: Change screen resolution when game is launched and switch back on exit
I quickly skimmed your script and it looks good to me. So lets try ruling out Qres as a potential issue. Lets use the Windows Command Line and Qres to test your resolution changes.
1. Open a Windows Command Window (Win+R, type "cmd", press OK)
2. Type "qres /c:32 /r:0 /x 1360 /y 768". Resolution should have changed.
3. Now type "qres /c:32 /r:75 /x 1920 /y 1080". Resolution should have changed again.
Did Qres function as you expected or was there an issue? If you have problems with the third line, try changing "r:75" to "r:0". If that works then your monitor does not support 75Hz refresh rate. "r:0" sets the refresh rate to the adapter default and "r:-1" sets refresh rate to the most optimal setting.
1. Open a Windows Command Window (Win+R, type "cmd", press OK)
2. Type "qres /c:32 /r:0 /x 1360 /y 768". Resolution should have changed.
3. Now type "qres /c:32 /r:75 /x 1920 /y 1080". Resolution should have changed again.
Did Qres function as you expected or was there an issue? If you have problems with the third line, try changing "r:75" to "r:0". If that works then your monitor does not support 75Hz refresh rate. "r:0" sets the refresh rate to the adapter default and "r:-1" sets refresh rate to the most optimal setting.