ALYB
June 30, 2023, 12:05pm
1
I need to translate the names of all files in several folders:
AB123456_Machine_Installation.dxf
AB1234567_Machine_Maintenance.dxf
The file names can contain the special characters äöüÄÖÜß.
I would like to generate a text file that contains all file names, translate this list, and then use it to rename all files.
What is the best way to handle this?
folder_with_examples.zip (1.4 KB)
ALYB
July 1, 2023, 9:48am
2
I can create a list of all file names in a folder with this macro:
The For Each Action can be exactly as @gglick 's original but instead of a declared path, use the Variable you have obtained through the Prompt for Folder.
Get All "Level-1" File and Folder Names - Prompt for Folder.kmmacros (3.7 KB)
Click to Show Image of Macro <a class="lightbox" href="https://forum.keyboardmaestro.com/uploads/default/original/3X/f/2/f293e075352ec7c1d69c258530b2c0ae551d31d3.jpeg" data-download-href="https://forum.keyboardmaestro.com/uploads/default…
And then translate the list and use this macro to rename the files:
I like VSC and have mixed feelings about Sublime – unfortunately neither of them is AppleScriptable.
I use VSC for writing JavaScript and a few other things, but my daily driver is BBEdit and has been for about 30 years now.
[image]
The appended macro makes use of a rename map table in a BBEdit document named “File Rename Map.txt”.
The BBEdit document MUST be named this way, although the user can change this if desired.
The Target-Directory is the FRONT FINDER WINDOW.
Note:
I have no…
ALYB
July 1, 2023, 10:09am
3
There are three steps involved:
The creation of the file list.
The (manual) translation in a CAT tool.
The renaming of the files via the translated file list.
Rename All Files Macros.kmmacros (17 KB)
I could be misunderstanding what you are trying to do. But you might not need to generate a list in order to translate the names of the selected files and rename those files.
I am on Ventura so, I can use an Apple Shortcut to do the translation. But I suppose the Magenta Action in the below could be replaced by however you are translating the text.
EXAMPLE Translate Names of Selected Files.kmmacros (3.7 KB)
Click to Show Image of Macro
https://www.icloud.com/shortcuts/cb24913760c0418a80ab33bef6b1bb9c
Click to Show Image of Shortcut
1 Like
ALYB
July 1, 2023, 11:35am
5
Thank you for your suggestion. My "old" hardware only allows for Big Sur, no support for Apple Translate.
And we translators do use machine translation in our CAT tools, but we always want to stay in control of the result ;).
1 Like