MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
input
Recherche

How To Use an Automator To Convert Text To Title Case?

mercredi 19 mai 2021, 17:19 , par MacMost
I’m a new Automator user. Using Automator and a javascript action, I’m attempting to convert the selected text to a Title case in desktop WhatsApp application where the contextual menu with Transformations – capitalize doesn’t show. However, it always comes with the error and posted below. Please assist me in resolving the issue. The following is the Javascript code in detail:
Javascript Code
—————–
function run(input, parameters) {
const patternStyle = /^w|[s.]w/gm;
input = input.replace(patternStyle, element => element.toUpperCase());
return input;
}
Error While Executing
————————–
Execution Error
Error: TypeError: input.replace is not a function. (In ‘input.replace (patternStyle, element E> element.toUpperCase ())’, ‘input.replace’ is undefined)
1. I have set up as a quick action under Automator with Workflow receives current text->in any application and Input is entire selection followed by Output replaces the selected text
2. Automator has only one action and it is Run Javascript Action with the above-posted code
—–
Kishore Kumar
https://macmost.com/forum-how-to-use-an-automator-to-convert-text-to-title-case.html
News copyright owned by their original publishers | Copyright © 2004 - 2024 Zicos / 440Network
Date Actuelle
mar. 16 avril - 16:57 CEST