You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the Paste Image Rename plugin to rename files dynamically based on templates. My workflow requires appending the file extension (e.g., .png, .jpg) to the renamed file title automatically, but the current template system does not support this.
Issue
Without access to the file extension in the rename pattern, I cannot dynamically include extensions in file titles. This limits my ability to automate workflows effectively, as other plugins (like Auto Note Mover) rely on title-based regex matching to sort files by type. Manually appending extensions to titles defeats the purpose of automation.
Request
Please add a {{fileExt}} variable (or equivalent) to the rename pattern system, allowing the file extension to be dynamically appended to the title. For example:
• Pattern: {{fileName}}-{{DATE:YYYYMMDD}}.{{fileExt}}
• Output: NoteTitle-20241115.png
Alternatively, consider a setting to toggle the inclusion of file extensions in rename patterns.
Conclusion
This feature would:
1. Enable seamless integration with file organization workflows (e.g., Auto Note Mover).
2. Enhance automation capabilities by avoiding manual file renaming.
3. Expand the plugin’s flexibility for advanced use cases, saving users time and effort.
Thank you for creating such a powerful tool. Let me know if more details would help!
The text was updated successfully, but these errors were encountered:
To enhance the Paste Image Rename plugin by incorporating the file extension into the rename pattern, consider the following approach:
Introduce a {{fileExt}} Variable:
Modify the plugin to recognize a new {{fileExt}} variable within the imageNamePattern. This variable would represent the file’s extension, enabling users to include it directly in their rename templates.
Update the generateNewName Function:
In the generateNewName function, extract the file extension and assign it to the fileExt variable. Then, pass this variable to the renderTemplate function alongside existing variables like fileName and imageNameKey.
Adjust the renderTemplate Function:
Enhance the renderTemplate function to process the {{fileExt}} variable. This adjustment allows the function to replace {{fileExt}} in the pattern with the actual file extension during the renaming process.
Update Documentation:
Reflect these changes in the plugin’s documentation, providing users with clear instructions on how to utilize the new {{fileExt}} variable in their rename patterns.
Example Implementation:
In the generateNewName function, after determining the fileName and other variables, add:
const fileExt = file.extension;
Then, pass fileExt to the renderTemplate function:
const stem = renderTemplate(
this.settings.imageNamePattern,
{
imageNameKey,
fileName: activeFile.basename,
dirName: activeFile.parent.name,
firstHeading,
fileExt, // Add this line
},
frontmatter
);
In the renderTemplate function, ensure it processes the fileExt variable appropriately.
By implementing these changes, users can dynamically include file extensions in their rename patterns, enhancing the plugin’s flexibility and integration with other tools.
Note: This approach assumes familiarity with the plugin’s codebase and JavaScript development within the Obsidian plugin framework.
Context
I use the Paste Image Rename plugin to rename files dynamically based on templates. My workflow requires appending the file extension (e.g., .png, .jpg) to the renamed file title automatically, but the current template system does not support this.
Issue
Without access to the file extension in the rename pattern, I cannot dynamically include extensions in file titles. This limits my ability to automate workflows effectively, as other plugins (like Auto Note Mover) rely on title-based regex matching to sort files by type. Manually appending extensions to titles defeats the purpose of automation.
Request
Please add a {{fileExt}} variable (or equivalent) to the rename pattern system, allowing the file extension to be dynamically appended to the title. For example:
• Pattern: {{fileName}}-{{DATE:YYYYMMDD}}.{{fileExt}}
• Output: NoteTitle-20241115.png
Alternatively, consider a setting to toggle the inclusion of file extensions in rename patterns.
Conclusion
This feature would:
1. Enable seamless integration with file organization workflows (e.g., Auto Note Mover).
2. Enhance automation capabilities by avoiding manual file renaming.
3. Expand the plugin’s flexibility for advanced use cases, saving users time and effort.
Thank you for creating such a powerful tool. Let me know if more details would help!
The text was updated successfully, but these errors were encountered: