diff --git a/OpenVRStartup/Program.cs b/OpenVRStartup/Program.cs index 062bc52..b6d189c 100644 --- a/OpenVRStartup/Program.cs +++ b/OpenVRStartup/Program.cs @@ -32,8 +32,7 @@ static void Main(string[] _) if (LogUtils.LogFileExists(PATH_LOGFILE)) { _isReady = true; - IntPtr winHandle = Process.GetCurrentProcess().MainWindowHandle; - ShowWindow(winHandle, SW_SHOWMINIMIZED); + Minimize(); } else { Utils.PrintInfo("\n========================"); @@ -43,8 +42,9 @@ static void Main(string[] _) Utils.Print($"\nWhen it runs it will in turn run all {FILE_PATTERN} files in the {PATH_STARTFOLDER} folder."); Utils.Print($"\nIf there are {FILE_PATTERN} files in {PATH_STOPFOLDER} it will stay and run those on shutdown."); Utils.Print("\nThis message is only shown once, to see it again delete the log file."); - Utils.Print("\nPress [Enter] in this window to continue execution."); + Utils.Print("\nPress [Enter] in this window to continue execution.\nIf there are shutdown scripts the window will remain in the task bar."); Console.ReadLine(); + Minimize(); _isReady = true; } @@ -54,6 +54,11 @@ static void Main(string[] _) OpenVR.Shutdown(); } + private static void Minimize() { + IntPtr winHandle = Process.GetCurrentProcess().MainWindowHandle; + ShowWindow(winHandle, SW_SHOWMINIMIZED); + } + private static bool _isConnected = false; private static void Worker() @@ -124,7 +129,7 @@ private static void RunScripts(string folder) { LogUtils.WriteLineToCache($"Found: {files.Length} script(s) in {folder}"); foreach (var file in files) { - LogUtils.WriteLineToCache($"Executing: {file} from {folder}"); + LogUtils.WriteLineToCache($"Executing: {file}"); var path = Path.Combine(Environment.CurrentDirectory, file); Process p = new Process(); p.StartInfo.CreateNoWindow = true; @@ -133,7 +138,7 @@ private static void RunScripts(string folder) { p.StartInfo.Arguments = $"/C \"{path}\""; p.Start(); } - if (files.Length == 0) LogUtils.WriteLineToCache($"Did not find any .cmd files to execute in {folder}"); + if (files.Length == 0) LogUtils.WriteLineToCache($"Did not find any {FILE_PATTERN} files to execute in {folder}"); } catch (Exception e) { @@ -143,6 +148,7 @@ private static void RunScripts(string folder) { private static void WaitForQuit() { + Utils.Print("This window remains to wait for the shutdown of SteamVR to run additional scripts on exit."); var shouldRun = true; while(shouldRun) { diff --git a/OpenVRStartup/Properties/Resources.Designer.cs b/OpenVRStartup/Properties/Resources.Designer.cs index e67d706..e593e07 100644 --- a/OpenVRStartup/Properties/Resources.Designer.cs +++ b/OpenVRStartup/Properties/Resources.Designer.cs @@ -61,7 +61,7 @@ internal Resources() { } /// - /// Looks up a localized string similar to v0.10. + /// Looks up a localized string similar to v0.11. /// internal static string Version { get { diff --git a/OpenVRStartup/Properties/Resources.resx b/OpenVRStartup/Properties/Resources.resx index 9be3c0e..b5d3467 100644 --- a/OpenVRStartup/Properties/Resources.resx +++ b/OpenVRStartup/Properties/Resources.resx @@ -118,6 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - v0.10 + v0.11 \ No newline at end of file