diff --git a/NAPS2.Lib/Automation/AutomatedScanning.cs b/NAPS2.Lib/Automation/AutomatedScanning.cs index 708b8e2c1c..b4a6203daf 100644 --- a/NAPS2.Lib/Automation/AutomatedScanning.cs +++ b/NAPS2.Lib/Automation/AutomatedScanning.cs @@ -735,7 +735,13 @@ private async Task PerformScan(ScanProfile profile) if (_options.WaitScan) { OutputVerbose(ConsoleResources.PressEnterToScan); - Console.ReadLine(); + var input = Console.ReadLine(); + if (input == null) + { + // Ctrl+D (EOF) detected - stop scanning and save + OutputVerbose(ConsoleResources.StoppingScan); + break; + } } if (_options.Delay > 0) { diff --git a/NAPS2.Lib/Lang/ConsoleResources/ConsoleResources.Designer.cs b/NAPS2.Lib/Lang/ConsoleResources/ConsoleResources.Designer.cs index caa1e3e586..882365ab52 100644 --- a/NAPS2.Lib/Lang/ConsoleResources/ConsoleResources.Designer.cs +++ b/NAPS2.Lib/Lang/ConsoleResources/ConsoleResources.Designer.cs @@ -430,7 +430,7 @@ internal static string PagesScanned { } /// - /// Looks up a localized string similar to Press Enter to scan.. + /// Looks up a localized string similar to Press Enter to scan, or Ctrl+D to stop and save.. /// internal static string PressEnterToScan { get { @@ -484,6 +484,15 @@ internal static string StartingScan { } } + /// + /// Looks up a localized string similar to Stopping scan and saving.... + /// + internal static string StoppingScan { + get { + return ResourceManager.GetString("StoppingScan", resourceCulture); + } + } + /// /// Looks up a localized string similar to Successfully saved PDF file to {0}. /// diff --git a/NAPS2.Lib/Lang/ConsoleResources/ConsoleResources.resx b/NAPS2.Lib/Lang/ConsoleResources/ConsoleResources.resx index 79219275e1..e2b3fe9264 100644 --- a/NAPS2.Lib/Lang/ConsoleResources/ConsoleResources.resx +++ b/NAPS2.Lib/Lang/ConsoleResources/ConsoleResources.resx @@ -148,7 +148,7 @@ Waiting {0}ms... - Press Enter to scan. + Press Enter to scan, or Ctrl+D to stop and save. Starting scan {0} of {1}... @@ -269,4 +269,7 @@ Use the "--importpassword" option. Cancelling... Press Ctrl+C again to terminate. + + Stopping scan and saving... + \ No newline at end of file