-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ctrl key to perform default action #6
Comments
Hi @David-Maisonave,
sorge13248/PasteIntoFile implemented the logic the other way round, automatically save it and only promt if holding SHIFT. The page linked in the readme under features explains how to use it, and there are several messages included in the program that explain how to get back the dialog after having enabled autosave. |
I think this can easily be implemented, such that SHIFT will always force the dialog to pop up, CTRL will always force it to not pop up, and the default behaviour depends on the automode option. Relevant code would be PasteIntoFile/PasteIntoFile/Dialog.cs Line 81 in eda356b
|
This would clash with the present usage of the SHIFT Key, but one could use ALT instead? What would be the use case? Why not create the folder manually, considering that you want to rename it anyways? Or just right-click the existing folder to paste? In automode, should the folder or the file be auto-selected for quick renaming? Should there be different subfolders per filetype? What should be their name? Should the foldername be configurable by the user via template, just like the filename? So many questions 😅 |
That's a difficult topic, because different users have different opinions on which extensions they would like to have as preset - and there are just too many to provide all. |
The latest version even supports different clipboard content types simultaneously, so it suggests image extensions if there is an image in the clipboard, text extensions if there is text, and both if both text and image happen to be in clipboard (and even further, the same mechanism exists for html, rtf, ...). In this sense I think your suggestion is already implemented. |
The use case is when a user is working on a particular folder, and doesn't want to move explorer path back and forth, this allows the user to stay on the same folder, but collect the data in a sub folder.
The use case is not for the purpose of creating the sub folder, but for allowing user to stay in one path while collecting the data in a sub path.
You can't use the ALT key, because as soon as the ALT key is press the context window closes.
I think using 2 keys for the same logic would be confusing to the user. IMHO, a better approach is to have the shift key perform the opposite of the current default behavior. That way the user doesn't have to memorize which key performs what function. In the code I implemented, the user can use both the ctrl+shift key to instantly create the files in a sub folder. Where the ctrl key forces no-popup and the shift key is used to trigger creating the sub folder. If in this implementation the shift key is being used to determine the no-popup, then the ctrl key can be used to trigger creating the sub folder. EslaMx7 has responded to my post, and said he'll pull in my changes. |
It sounds like for this use case it's really as easy as doing the right-click on this particular subfolder (rather than on the background of the current one), which will save the file into the folder you did the right-click on.
Good point, I like your argument. So SHIFT would basically temporarily invert the Automode setting 👍 |
Additional Use CaseAnother use case for supporting default folder option is for a user who wants to optionally specify an explicit (FQN) directory instead of a sub directory. In my new code this is accomplished with the same logic, but with a one line change that checks if the default folder has the ":" character. See second to last line in the code example. Default Folder Options
I didn't see these questions before. In my code I only use two different types. Text and Image. By default those are the folder names, but the user has the option to change the default folder names via command line, or by modifying the registry directly. Here's how the command line options work: From the Readme.md:
Right Clicking a Sub Folder
Right clicking the sub folder can be difficult to do if the directory has many sub folders. Feature ImplementationThe implementation for this feature is surprisingly small, where 80% of the changes are in function frmMain_Load. This includes the registry key fetching logic, checking for ctrl key pressed, and support for both sub path and FQN path. txtCurrentLocation.Text = CurrentLocation ?? @"C:\";
const string DEFAULT_TEXT_SUBFOLDER = "Text";
const string DEFAULT_IMAGE_SUBFOLDER = "Image";
string TextDefaultDir = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Classes\Directory\shell\Paste Into File\TextDefaultDir", "", null) ?? DEFAULT_TEXT_SUBFOLDER;
string ImageDefaultDir = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Classes\Directory\shell\Paste Into File\ImageDefaultDir", "", null) ?? DEFAULT_IMAGE_SUBFOLDER;
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
{
string DefaultDir = (Clipboard.ContainsText()) ? TextDefaultDir : ImageDefaultDir;
txtCurrentLocation.Text = (DefaultDir.IndexOf(":") > 0) ? DefaultDir : txtCurrentLocation.Text + @"\" + DefaultDir;
} The Save_Action function listed below, has a change which I think should be added even without the above changes, because if the user adds a sub folder manually in the "Current Location" field, this code will create the folder if it doesn't exist. if (!Directory.Exists(location))
Directory.CreateDirectory(location); The only other changes are the command line options, which are not absolutely required, but makes it easier for the user to make the registry key changes. if (args.Length>0)
{
if ...
else if (string.Equals(args[0], "/TextDefaultDir", StringComparison.CurrentCultureIgnoreCase) && args.Length > 1)
{
var key = OpenDirectoryKey().CreateSubKey("shell").CreateSubKey("Paste Into File");
key = key.CreateSubKey("TextDefaultDir");
key.SetValue("", args[1]);
return;
}
else if (string.Equals(args[0], "/ImageDefaultDir", StringComparison.CurrentCultureIgnoreCase) && args.Length > 1)
{
var key = OpenDirectoryKey().CreateSubKey("shell").CreateSubKey("Paste Into File");
key = key.CreateSubKey("ImageDefaultDir");
key.SetValue("", args[1]);
return;
} FYI:In my update for EslaMx7/PasteIntoFile, I switch the keys to have the shift key do the no-popup, but when I tried to implement the right mouse button, I couldn't figure out how to notify the program that the right mouse button was used in the context menu. |
I prepared a PR: #7
Already implemented a while ago
No idea, I don't think this is possible |
Hi @David-Maisonave |
Describe your idea in general, its use case and its benefits:
I posted this feature request on EslaMx7/PasteIntoFile, and I implemented the changes on David-Maisonave/PasteIntoFile before I realized there was a more updated version of this program here.
I look to see if I could port the changes to this version of PasteIntoFile, but the source code for this version looks very different.
I see there is an "Autosave Mode" in this version, but it's an option that has to be pre-selected. Also the text under Features doesn't state how the user would deselect (uncheck) Autosave if the user wanted to set it back.
On my modified version, I also added additional text file types, and I also made it only display text file types for text, and only image types for images. Most of the changes I made only had to be made in function frmMain_Load.
Related:
The text was updated successfully, but these errors were encountered: