Hi everybody,
I'd like to give 3 parameters to a exe: screen height, screen width and screen refresh rate (Hertz).
E.g.: -params 1280,1024,60.
I don't think there is a portableapps variable for it, so I searched for a NSIS solution.
For screen height and width I found this: http://nsis.sourceforge.net/Get_User%27s_screen_resolution .
But I couldn't find anything usefull for the screen refresh rate.
Anyway, I'd like to give the first two a go, I'll hardcode the framerate for a while.
Can somebody help me to add these to the CommandLineArguments value in launcher.ini?
I've searched the forums and checked the launcher manual, but I couldn't find something to change/add a value.
This is the line I currently have in launcher.ini.
CommandLineArguments=' -Vidmode 1280,1024,60'
Do I have to delete the line and set it completely in Custom.nsh? If so, what NSIS call do I use?
Or replace "-Vidmode 1280,1024,60" with "-Vidmode AAAA,BBBB,CCCC" and replace these letters by the right values before the exe starts and reverse the change when the exe is finished?
This is all I thought about, can someone give me a hint?
Thanks in advance!
I would suggest using that function in Custom.nsh, and then set environment variables for the results.
You would then include those variables in your command line arguments, something like -Vidmode %ScreenHeight%,%ScreenWidth%, 60
Ok, it worked, here's the code if anyone is interested:
${SegmentInit} System::Call 'user32::GetSystemMetrics(i 0) i .r0' System::Call 'user32::GetSystemMetrics(i 1) i .r1' System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("ScreenHeight", $0).r2' StrCmp $2 0 error1 Goto done1 error1: MessageBox MB_OK "Can't set environment variable for ScreenHeight" done1: System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("ScreenWidth", $1).r3' StrCmp $3 0 error2 Goto done2 error2: MessageBox MB_OK "Can't set environment variable for ScreenWidth" done2: !macroendI'm not sure if the location of the code (Init) is ok, but hey, it works!
Yes, I set the working directory!
That code can be simplified considerably.
${SegmentFile} ${SegmentInit} System::Call user32::GetSystemMetrics(i0)i.r0 System::Call user32::GetSystemMetrics(i1)i.r1 ${SetEnvironmentVariable} ScreenHeight $0 ${SetEnvironmentVariable} ScreenWidth $1 !macroendI am a Christian and a developer and moderator here.
“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1
Thanks, I'm not that into the NSIS syntax.
Hopefully that'll change soon
Yes, I set the working directory!