Transnomino Automation

Transnomino icon

How Transnomino supports automation at the command line and Apple Script

Command Line Support

Transnomino can be launched from the command line. It optionally accepts the following command line arguments:

-d path

Specifies the Path to the directory to open for renaming. It needs to be a full path and it needs to be enclosed in double-quotes in case the path contains spaces. You can refer to your home directory with the ~ character.

To add multiple directories, specify each directory in a separate -d argument.


-d ~/Pictures

-d ~/Pictures -d "/Volumes/LocalNas/Some Directory With Spaces/"

-r file

Specifies a Recipe file to open.


-r "~/Recipes/photos.recipe"

-r json

Specifies a complete contents of a Recipe file as a JSON string. The JSON string must be enclosed in single quotes and in case the Recipe JSON string contains any single quotes characters, these single quotes must be escaped by: '"'"'.


-r '{"recipe_format_version":"3.14", "transformers": [{"title":"Replace", "disabled":false, "transformScope":"filename", "type":"simple", "id":"transformer_171098B693A", "properties":{"simpleFindText":"this", "simpleReplaceText":{ "properties":[ {"type":"string","value":"that"} ],"object":"TokenString"}, "simpleWildcards":"0", "simpleCaseInsensitive":"0"}}] }'


open -a Transnomino --args -d "~/Pictures" -r "~/Recipes/photos.recipe"

Folder Automation

Let Transnomino monitor a designated folder and automatically launch with a recipe when any files are dropped in that folder.

Example of an automated folder
How to set this up

We need to create a Folder Action Script, a Folder and a Recipe and then bind these three together.

Step 1 - Create Folder Action Apple Script

Create a new Apple Script that can be attached to a specific folder as a Folder Action Script. This step only needs to be done one time.

Launch the "Script Editor" utility found in Applications/Utilities and paste the below Apple Script code into a new document. Compile the script (Command-K) and save it as "rename-with-transnomino" in: "~/Library/Scripts/Folder Action Scripts"

The Apple Script Editor
on adding folder items to theAttachedFolder after receiving theNewItems
    tell application "Finder" to set thePath to POSIX path of theAttachedFolder
    return do shell script ¬
        "open -a Transnomino --args -d \"" & thePath & "\" -r \"" & thePath & ".recipe\""
end adding folder items to  
Step 2 - Create a folder

Create a new folder that will be the folder Transnomino will monitor. For this example, create a new folder named "Drop Files Here" on your Desktop.

The Drop Files Here folder
Step 3 - Create a Folder Recipe

Create a new Recipe that Transnomino should use when files are dropped into the monitored folder.
Save it as a hidden file named ".recipe" in the "Drop Files Here" folder.

Transnomino Recipe
Step 4 - Attach the script to the folder

If the previous steps are done correctly, you can now launch the "Folder Action Setup" utility and attach the "Drop Files Here" folder to the "rename-with-transnomino" script.

Folder Action Setup initial screen Folder Action Setup selecting the script Folder Action Setup should look like this

Apple Script Support

Transnomino can be controlled by Apple Script as well.

open recipe v

Opens a recipe from either a recipe file or by passing a complete JSON string of the contents of a recipe file.

v - The path to the recipe file or the JSON string of the contents of a recipe file

open directory v

Opens a directory with files to rename.

v - The directory string with files to rename.

clear transformers

Clears the list of transformers, which is required to do before adding new ones using add transformer.

add transformer v

Adds a new transformer with the details as specified in the JSON argument.

v - The JSON string describing the transformer type and its properties. This structure is similar as to the transformer structure as used in the recipe files.

rename v

Rename all files on disk. Renaming will only proceed if none of the files have validation errors.

v - Boolean force flag, when set it indicates to continue renaming when one or more files have validation errors.

file n

A file item, n specifying the index of the file to query.

  • id - The identifier used by the application.
  • original path - The original path of the file.
  • original name - The original filename of the file.
  • original ext - The original extension of the file.
  • transformed path - The transformed path of the file.
  • transformed name - The transformed filename of the file.
  • transformed ext - The transformed extension of the file.
  • errors - A list of validation error messages for this file.


A property containing the latest validation results.

  • total count - The total number of loaded files.
  • error count - The total number of files in error.
  • rename count - The total number of files that will be renamed.

Example Script

The following script opens transnomino, clears the existing transformer and adds a new transformer that will replace the text "DCS" from filenames with "IMG". It opens a directory at: "/Users/bastiaan/demo/Photos" and checks the validation results of those files. In case there are no errors, it calls rename without force to apply the renaming and quit.

  on stringlist(thelist)
  set str to "
  repeat with listitem in thelist
    set str to str & listitem & "
  end repeat
  return str
end stringlist

tell application "Transnomino"
  clear transformers
  open directory "/Users/bastiaan/demo/Photos"
  add transformer "{\"type\": \"simple\",\"transformScope\": \"filename\",\"properties\": {\"simpleWildcards\": true,\"simpleFindText\": \"DSC\",\"simpleReplaceText\": {\"properties\": [{\"type\": \"string\",\"value\": \"IMG\"}]}}}"
  # Wait until validation results are available
  set totalcount to 0
  repeat while totalcount = 0
    set totalcount to get total count of validation result
    delay 1
  end repeat
  log "Total number of files: " & totalcount
  set renamecount to get rename count of validation result
  log "Total files to be renamed: " & renamecount
  set errorcount to get error count of validation result
  log "Total files with errors: " & errorcount
  if errorcount = 0 and renamecount > 0 then
    rename without force
    set filenames to my stringlist(get transformed full path of files whose errors is {})
    log "Filenames:
  " & filenames
    set allerrors to my stringlist(get errors of files whose errors is not {})
    log "Errors:
  " & allerrors
  end if
end tell