SplitText.jsx is a script for Adobe After Effects designed for intelligent text layer splitting with respect to formatting rules, geographical names, company names, and other special terms.
Version: 1.2
Author: tannenspiel@gmail.com
Language: ExtendScript (JavaScript for Adobe)
- Splits a text layer into two separate layers (or multiple layers if "Split into Layers by Lines" is enabled)
- Supports multiple layer selection
- Automatically copies source layer properties (position, scale, rotation, opacity)
- Supports splitting by symbol, by lines, or automatically at the middle
- "Split into Layers by Lines" mode: When enabled, divides text by lines - each line becomes a separate layer
- Splits a long line into two lines in the same layer
- Recursively processes all lines in the text
- Supports different line break types (\r\n, \r, \n)
- Renames and numbers selected layers (text and non-text layers)
- Sorts layers by start time (inPoint)
- Supports name masks with
{num}placeholder - 4-digit numbering (0001, 0002, 0003...)
- "Up" checkbox: Inverts numbering and sorting order
- When disabled: earliest inPoint → number 0001 (at top)
- When enabled: earliest inPoint → highest number (at bottom)
📹 Watch the tutorial: SplitText v1.2 Tutorial
-
Copy the
SplitText v1.2.jsxfile to the After Effects scripts folder:- Windows:
C:\Program Files\Adobe\Adobe After Effects [version]\Support Files\Scripts\ - Mac:
/Applications/Adobe After Effects [version]/Scripts/
- Windows:
-
Run the script through After Effects menu:
- File → Scripts → Run Script File...
- Or use the Window → Scripts panel
- Split into Layers - splits text into two separate layers
- Split into Lines - splits text into two lines in the same layer
- Split into Layers by Lines - when enabled, "Split into Layers" divides text by lines (each line becomes a separate layer)
- Split at Layer Middle - automatically split at the middle of layer duration
- Use Split Symbol - use a split symbol (specified in the field below)
- Split Symbol - field for entering the split symbol (default:
$)
- Name Mask - mask for layer name (you can use
{num}for the number) - Rename & Number Layers - button for renaming and numbering
- Up - checkbox to invert numbering and sorting order
- Disabled (default): Earliest inPoint gets number 0001 and is placed at top
- Enabled: Earliest inPoint gets highest number and is placed at bottom
The script uses intelligent rules to prevent incorrect text splitting:
- ONLY: prepositions, articles, conjunctions, pronouns (Russian and English)
- DOES NOT include: auxiliary verbs, adverbs, quantifiers (removed in v1.2 to eliminate conflicts)
- Abbreviations ("т.е.", "и т.д.", "etc.", "e.g.", etc.)
- Units of measurement ("kg", "km", "sec", "min", etc.)
- Combinations of abbreviations with numbers ("рис. 1", "стр. 5")
- ONLY: multi-word prepositions, geographical names, companies
- DOES NOT include: "subject+verb" pairs like "i have", "we will" (removed in v1.2 to eliminate conflicts)
- Phraseological constructions ("так как", "потому что", "in order to", "according to", etc.)
- Geographical names:
- Cities: "New York", "Los Angeles", "Нижний Новгород", "Великий Новгород", etc.
- Regions: "New South Wales", "British Columbia", "Республика Саха", etc.
- Companies and brands:
- "General Motors", "Goldman Sachs", "Альфа Банк", "Яндекс Такси", etc.
- Opening characters:
",',(,[,{,« - Special characters:
,,.,!,?,:,;
\r\n(CRLF - Windows)\r(CR - old Mac)\n(LF - Unix/Linux)
- "Split into Layers by Lines" mode (if enabled): Simple line-by-line splitting - each line becomes a separate layer
- Line breaks (only for "Split into Layers" when "Split into Layers by Lines" is disabled)
- Split symbol (if "Use Split Symbol" checkbox is enabled)
- Automatic search - nearest space to the middle of the text with respect to rules
- Compound expressions (multi-word prepositions, geographical names, companies) - priority #1
- Words from avoidEndWords (prepositions, articles, conjunctions, pronouns) - priority #2
- Words that are never split (abbreviations, units of measurement) - priority #3
- Special terms (cities, brands) - priority #4
- Basic rules (opening characters, special characters) - priority #5
- When selecting multiple layers for "Split into Layers" - splitting occurs at the middle of each layer's duration
- When selecting multiple layers for "Split into Lines" - each layer is processed separately
- When renaming - all selected layers are renamed and sorted by
inPoint
- If the mask contains
{num}- it is replaced with a 4-digit number - If
{num}is not present - the number is added at the end - Numbering order depends on "Up" checkbox:
- "Up" disabled: Layers are numbered from earliest to latest inPoint (0001, 0002, 0003...)
- "Up" enabled: Layers are numbered from latest to earliest inPoint (highest number for earliest inPoint)
- Examples (with "Up" disabled):
- Mask:
"Text {num}"→"Text 0001","Text 0002" - Mask:
"Scene"→"Scene 0001","Scene 0002"
- Mask:
- The script works only with text layers for splitting
- All layer types are supported for renaming
- An active composition is required
- At least one selected layer is required
- For multiple selection in "Split into Layers", the middle of layer duration is always used (cursor position is not taken into account)
- Recursive line splitting may take time with a large number of lines
A detailed map of all functions and data structures is available in SCRIPT_MAP.md.
- UI initialization (lines 1-85)
- Data arrays (lines 91-243)
- Validation functions (lines 248-283, 1002-1047)
- Splitting functions (lines 288-621)
- Formatting rules functions (lines 626-978)
- Renaming functions (lines 1052-1177)
- Event handlers (lines 1182-1195)
- SCRIPT_MAP.md - Map of all functions with line numbers
- Critical fix: Cleaned up
avoidEndWordsandcompoundExpressionslists to eliminate conflicts- Removed auxiliary verbs, adverbs, quantifiers from
avoidEndWords - Removed "subject+verb" pairs from
compoundExpressions - Now "I have a dream" correctly splits into "I have" + "a dream"
- Removed auxiliary verbs, adverbs, quantifiers from
- Simplified compound expression checking logic
- Improved
findCompoundSafePositionfunction for more accurate position search - Fixed
lineSplitInfo.positioncheck inupdateLayerText - Added "Up" checkbox for inverted numbering and sorting order
- When enabled: earliest inPoint gets highest number and is placed at bottom
- Fixed numbering to follow chronological order of inPoints
- Added "Split into Layers by Lines" checkbox for simple line-by-line splitting
- When enabled: "Split into Layers" divides text by lines - each line becomes a separate layer
- Ignores formatting rules and simply splits at line breaks
- All alert messages translated to English
- Removed debug messages
- Updated documentation
- Added support for multiple layer selection
- Added layer renaming and numbering function
- Extended formatting rules (geographical names, companies)
- Improved line break handling
- Added recursive processing of multiple lines
- Initial version
- Basic text splitting
- Basic formatting rules
Email: tannenspiel@gmail.com
The script is provided "as is" without any warranties.