PDF-ShellTools > Ideas/Suggestions
replace filename
(1/1)
Nick Riviera:
Hello,
...can I replace a string from a filename with a custom script...?
something like this:
[ReplaceS:replace this|[myScript]]([f])
RTT:
Not possible while using the builtin ReplaceS function (the parameters are fixed, not parsed for dynamic content), but doable with a custom script.
With a custom script, named ReplaceStr, with this code:
--- Code: ---function ReplaceStr() {
var params = CurrentField.value.split(',', 3);
if (params.length == 3) {
return params[0].replace(params[1], params[2]);
}
}
--- End code ---
you can then use this syntax: [ReplaceStr](source,searchValue,newValue)
With your example: [ReplaceStr]([F],replace this,[myScript])
Nick Riviera:
thank you for reply and for the explanations
but,
I do not know if the function ReplaceStr does not work or I did not proceed correctly...
01_replace this_document.pdf
the result should be:
01_210x297mm_document.pdf
RTT:
In your screenshot the [ReplaceStr] part of the expression is not showing in blue, so your custom scripts don't have a script named ReplaceStr. Probably you forgot to rename the newly added script or mistyped the name.
Nick Riviera:
you're right,my mistake.. it's works..solved!Thanks!
Navigation
[0] Message Index
Go to full version