diff --git a/PasteIntoFile/App.config b/PasteIntoFile/App.config index cecf5ca..92c7228 100644 --- a/PasteIntoFile/App.config +++ b/PasteIntoFile/App.config @@ -31,6 +31,9 @@ False + + {0:yyyy-MM-dd} + \ No newline at end of file diff --git a/PasteIntoFile/Dialog.cs b/PasteIntoFile/Dialog.cs index ad665d5..d45e97c 100644 --- a/PasteIntoFile/Dialog.cs +++ b/PasteIntoFile/Dialog.cs @@ -21,8 +21,9 @@ public partial class Dialog : MasterForm public Dialog(string location, bool forceShowDialog = false) { - // always show GUI if shift pressed during start - forceShowDialog |= ModifierKeys == Keys.Shift; + // flag if key is pressed during start + bool invertAutosave = (ModifierKeys & Keys.Shift) == Keys.Shift; + bool saveIntoSubdir = (ModifierKeys & Keys.Control) == Keys.Control; // Setup GUI InitializeComponent(); @@ -58,7 +59,8 @@ public Dialog(string location, bool forceShowDialog = false) var clipRead = readClipboard(); updateFilename(); - txtCurrentLocation.Text = Path.GetFullPath(location); + if (saveIntoSubdir) location += @"\" + formatFilenameTemplate(Settings.Default.subdirTemplate); + txtCurrentLocation.Text = location; chkClrClipboard.Checked = Settings.Default.clrClipboard; chkContinuousMode.Checked = continuousMode; updateSavebutton(); @@ -68,22 +70,21 @@ public Dialog(string location, bool forceShowDialog = false) txtFilename.Select(); - // show dialog or autosave option - if (forceShowDialog) - { + // show dialog or perform autosave + bool showDialog = forceShowDialog || !(Settings.Default.autoSave ^ invertAutosave); + if (showDialog) { // Make sure to bring window to foreground (holding shift will open window in background) WindowState = FormWindowState.Minimized; Show(); BringToFront(); WindowState = FormWindowState.Normal; } - // otherwise perform autosave if enabled - else if (Settings.Default.autoSave) - { + else { var file = clipRead ? save() : null; if (file != null) { - ExplorerUtil.RequestFilenameEdit(file); + if (!saveIntoSubdir) + ExplorerUtil.RequestFilenameEdit(file); Program.ShowBalloon(Resources.str_autosave_balloontitle, new []{file, Resources.str_autosave_balloontext}, 10); diff --git a/PasteIntoFile/Main.cs b/PasteIntoFile/Main.cs index c235a89..11ef3cc 100644 --- a/PasteIntoFile/Main.cs +++ b/PasteIntoFile/Main.cs @@ -16,7 +16,9 @@ static class Program class ArgsCommon { - [Option('f', "filename", HelpText = "Filename template with optional date format variable such as {0:yyyyMMdd HHmmSS}")] + [Option('f', "filename", HelpText = "Filename template with optional format variables such as\n" + + "{0:yyyyMMdd HHmmSS} for current date and time\n" + + "{1:000} for batch-mode save counter")] public string Filename { get; set; } [Option("text-extension", HelpText = "File extension for text contents")] @@ -25,6 +27,9 @@ class ArgsCommon [Option("image-extension", HelpText = "File extension for image contents")] public string ImageExtension { get; set; } + [Option("subdir", HelpText = "Template for name of subfolder to create when holding CTRL (see filename for format variables)")] + public string Subdir { get; set; } + [Option('c', "clear", HelpText = "Clear clipboard after save (true/false)")] public bool? ClearClipboard { get; set; } @@ -217,6 +222,8 @@ static void ApplyCommonArgs(ArgsCommon args) Settings.Default.extensionText = args.TextExtension; if (args.ImageExtension != null) Settings.Default.extensionImage = args.ImageExtension; + if (args.Subdir != null) + Settings.Default.subdirTemplate = args.Subdir; if (args.ClearClipboard != null) Settings.Default.clrClipboard = (bool) args.ClearClipboard; if (args.Autosave != null) diff --git a/PasteIntoFile/Properties/Resources.Designer.cs b/PasteIntoFile/Properties/Resources.Designer.cs index 8e0ede6..415eb8f 100644 --- a/PasteIntoFile/Properties/Resources.Designer.cs +++ b/PasteIntoFile/Properties/Resources.Designer.cs @@ -482,7 +482,7 @@ internal static string str_wizard_autosave_button { } /// - /// Looks up a localized string similar to You can configure Paste Into File to automatically save the file without prompting for filename and extension. Instead, the file created will be selected for renaming in the explorer window. To show the dialog again, run the PasteInfoFile executable without arguments or hold the SHIFT key while selecting the context menu entry. You can change this setting later.. + /// Looks up a localized string similar to You can configure Paste Into File to automatically save the file. When enabled, the dialog prompting for filename and extension is skipped and the file will be created and selected for renaming in the explorer window instead. This setting can be changed later. To temporarily invert the setting, hold the SHIFT key when running Paste Into File. Note that the dialog is always shown when executing Paste Into File without command line arguments.. /// internal static string str_wizard_autosave_info { get { diff --git a/PasteIntoFile/Properties/Resources.de.resx b/PasteIntoFile/Properties/Resources.de.resx index 9f46de2..f4ec129 100644 --- a/PasteIntoFile/Properties/Resources.de.resx +++ b/PasteIntoFile/Properties/Resources.de.resx @@ -91,7 +91,7 @@ Autosave aktivieren - Das Programm kann so konfiguriert werden, dass Dateien automatisch gespeichert werden, ohne dass der Dialog zur Eingabe von Dateinamen und -typ geöffnet wird. Stattdessen wird die erstellte Datei im Explorer zum Umbenennen markiert. Um den Dialog wieder anzuzeigen kann PasteIntoFile ohne Argumente ausgeführt werden, oder während des Programmstarts die Umschalttaste gedrückt gehalten werden. Diese Einstellung kann später angepasst werden. + Das Programm kann so konfiguriert werden, dass Dateien automatisch gespeichert werden. Dabei wird der Dialog zur Eingabe von Dateinamen und -typ übersprungen, und die erstellte Datei im Explorer zum Umbenennen markiert. Diese Einstellung kann später angepasst und jederzeit durch halten der Umschalttaste einmalig umgekehrt werden. Wenn Paste Into File ohne Argumente ausgeführt wird, wird der Dialog stets angezeigt. Datei automatisch ohne Dialog speichern? diff --git a/PasteIntoFile/Properties/Resources.resx b/PasteIntoFile/Properties/Resources.resx index e415114..de52da2 100644 --- a/PasteIntoFile/Properties/Resources.resx +++ b/PasteIntoFile/Properties/Resources.resx @@ -219,7 +219,7 @@ Do you want to overwrite it? Finish setup - You can configure Paste Into File to automatically save the file without prompting for filename and extension. Instead, the file created will be selected for renaming in the explorer window. To show the dialog again, run the PasteInfoFile executable without arguments or hold the SHIFT key while selecting the context menu entry. You can change this setting later. + You can configure Paste Into File to automatically save the file. When enabled, the dialog prompting for filename and extension is skipped and the file will be created and selected for renaming in the explorer window instead. This setting can be changed later. To temporarily invert the setting, hold the SHIFT key when running Paste Into File. Note that the dialog is always shown when executing Paste Into File without command line arguments. Batch mode diff --git a/PasteIntoFile/Properties/Settings.Designer.cs b/PasteIntoFile/Properties/Settings.Designer.cs index 4f37105..a1fc397 100644 --- a/PasteIntoFile/Properties/Settings.Designer.cs +++ b/PasteIntoFile/Properties/Settings.Designer.cs @@ -106,5 +106,17 @@ public bool upgradePerformed { this["upgradePerformed"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("{0:yyyy-MM-dd}")] + public string subdirTemplate { + get { + return ((string)(this["subdirTemplate"])); + } + set { + this["subdirTemplate"] = value; + } + } } } diff --git a/PasteIntoFile/Properties/Settings.settings b/PasteIntoFile/Properties/Settings.settings index 7c34542..e2ac638 100644 --- a/PasteIntoFile/Properties/Settings.settings +++ b/PasteIntoFile/Properties/Settings.settings @@ -23,6 +23,9 @@ False + + {0:yyyy-MM-dd} + diff --git a/README.md b/README.md index 46d2ce1..2b4b26f 100644 --- a/README.md +++ b/README.md @@ -5,17 +5,18 @@ [![Latest release](https://img.shields.io/github/v/release/eltos/PasteIntoFile)](https://github.com/eltos/PasteIntoFile/releases/latest) [![Total downloads](https://img.shields.io/github/downloads/eltos/PasteIntoFile/total)](https://github.com/eltos/PasteIntoFile/releases) +## About + A Windows desktop application to paste clipboard contents into files and copy file contents to the clipboard via the context menu ----------------- + _This is a fork of [sorge13248/PasteIntoFile](https://github.com/sorge13248/PasteIntoFile), itself being a fork of [EslaMx7/PasteIntoFile](https://github.com/EslaMx7/PasteIntoFile)._ _See the [contributors page](https://github.com/eltos/PasteIntoFile/graphs/contributors) for details on collaborators._ - -_This fork contains many new core functionalities such as clipboard monitoring, batch mode and rename inside the file explorer. In addition, the GUI was completely redesigned to make the layout resizeable and allow for comfortable text and image preview._ +_This fork comes with many new features such as clipboard monitoring, batch mode, rename inside file explorer, copy file contents, paste into subdirectory, support for many additional formats and a new GUI with fluid layout and comfortable text, image, HTML and richt-text preview._ _The full changelog can be found on the [release page](https://github.com/eltos/PasteIntoFile/releases)._ ----------------- + ## Features @@ -47,13 +48,23 @@ Further options can be accessed through the main GUI or via command line options Help is available via [GitHub discussions](https://github.com/eltos/PasteIntoFile/discussions/categories/q-a) +### Key modifiers + +Hold the following keys while launching Paste Into File +- **SHIFT** inverts autosave settings once + When autosave is enabled, holding SHIFT will show the dialog anyways + When autosave is disabled, holding SHIFT will skip the dialog anyways +- **CTRL** saves to a subdirectory + Holding CTRL will save to an intermediate subdirectory + The subfolder name supports templates and can be configured via command line options + ## Command Line Use Use `help`, `help paste`, `help config` etc. to show available command line options, e.g.: -```powershell +``` > .\PasteIntoFile.exe help -PasteIntoFile 4.0.0.0 +PasteIntoFile 4.2.0.0 Copyright © PasteIntoFile GitHub contributors paste (Default Verb) Paste clipboard contents into file @@ -65,14 +76,17 @@ Copyright © PasteIntoFile GitHub contributors ``` ``` > .\PasteIntoFile.exe help paste -PasteIntoFile 4.0.0.0 +PasteIntoFile 4.2.0.0 Copyright © PasteIntoFile GitHub contributors -d, --directory Path of directory to save file into - -f, --filename Filename template with optional date format variable such - as {0:yyyyMMdd HHmmSS} + -f, --filename Filename template with optional format variables such as + {0:yyyyMMdd HHmmSS} for current date and time + {1:000} for batch-mode save counter --text-extension File extension for text contents --image-extension File extension for image contents + --subdir Template for name of subfolder to create when holding + CTRL (see filename for format variables) -c, --clear Clear clipboard after save (true/false) -a, --autosave Autosave file without prompt (true/false) --help Display this help screen.