remove a part of the writing
Saving uxp file
remove part of save name
from so
_DSC0193a.jpg_3.jpg
to so
_DSC0193a_3.jpg
Saving uxp file
remove part of save name
from so
_DSC0193a.jpg_3.jpg
to so
_DSC0193a_3.jpg
Without your sample code I can't give the following any context, as saving files in UXP isn't as simple as with ExtendScript.
In ExtendScript, you can use a regular expression in a variable such as:
var fileName = app.activeDocument.name.replace(/^(.*)\.jpg(_.*\.jpg)$/, '$1$2');
It's probably the same or very similar with UXP DOM, you would likely just change the var for let etc.
EDIT:
The following UXP code works:
const photoshop = require("photoshop");
const core = photoshop.core;
let fileName = app.activeDocument.name.replace(/^(.*)\.jpg(_.*\.jpg)$/, '$1$2');
core.showAlert(fileName);

Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.