microsoft / microsoft/PowerToys
PowerRename: Allow mouse capture of selected filename text from Original filename column for reuse in search-and-replace
- Dominant language
- C
- Stars
- 139k
- Forks
- 8.6k
- PR merge metrics
- PR metrics pending
Description
### Description of the new feature / enhancement
PowerRename should allow the user to select a portion of a filename directly in the "Original" filename column by dragging over the text with the mouse.
The selected text could then be transferred to the "Search for" field, or the "Replace with" field, or stored as a temporary capture value for use in the rename operation.
For example, the user could:
Drag the mouse over part of a filename in the Original filename list.
Right-click the selected text.
Choose an option such as:
- Use as search text
- Use as replacement text
- Create capture from selection
- Copy to Search for
- Preview and apply the rename operation.
This would provide a faster and more intuitive way to build rename rules from text that is already visible in the filenames.
**NOTE:** At present, this can sometimes be done with regular-expression capture groups, but that requires the user to understand and construct a regular expression, something that, I suspect, a large majority of PowerRename users are unable to do. A graphical or assisted method would make this capability available to users who do not regularly use regex.
### Scenario when this would be used?
I frequently rename files that contain a common string sequence. The text I need is already visible in the Original filename list, but PowerRename does not allow me to select that text directly with the mouse and use it in the rename controls.
I may want to select the string sequence directly from the Original list and use it in the search-and-replace operation without retyping it.
A typical workflow would be:
1. Select the files in File Explorer and open PowerRename.
2. Locate the desired text in one filename in the Original column.
3. Drag over that portion of the filename with the mouse.
4. Right-click the selection or click a nearby command button.
5. Send the selected text to the Search or Replace field.
6. Adjust the rule if necessary and review the preview.
7. Apply the rename.
### Supporting information
The Original filename list already displays the exact text being processed, so allowing mouse selection would make that list more useful as an input source rather than only as a display.
Possible implementation options include:
- Making text in the Original column selectable with the mouse.
- Adding a right-click menu for selected text.
- Providing commands such as Use as search text and Use as replacement text.
- Adding small buttons to transfer the selection to the Search or Replace field.
- Automatically escaping characters that have a special meaning in regular expressions.
- Providing an optional command to convert the selected portion into a capture group.
- Highlighting the corresponding text in other filenames when the same pattern is present.
This would not replace regular expressions or capture groups. It would provide a simpler mouse-driven method of creating search-and-replace rules from text that is already present in the filenames.
The main benefit would be reducing retyping, spelling errors, and the need to manually construct regular expressions for straightforward rename operations.
Contributor guide
Research direction
Start by locating PowerRename's Original filename list and the existing Search for and Replace with controls. Determine how text selection and context-menu actions are handled in that UI. Done means selected filename text can be transferred to the requested rename control or capture workflow, with the preview and rename operation still working.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100