Vertical Address Scripting Tips 3 of 5          —宛名の縦書き Tipsパート3— 

This is #3 of 5 series Tips about the vertically address scripting (wiki : Horizontal and vertical writing in East Asian scripts).
To use this tips, it is necessary that you have a Japanese version of Adobe InDesign because it use one of the build-in feature of that only available in Japanese version of Adobe InDesign.

As basic knowledge and tips of the vertical address scripting, please refer to my old post regarding the vertical address scripting.

これは宛名の縦組みに関するTipsシリーズのパート3です。本Tipsの使用は日本語版のAdobe InDesign使用を前提としています。


How to change text frame depends on how many digit in the customer address as maximum.


This tips if for user who have below request.

  • Need to display customer address in different text frame which have different text formatting, only when address contain multiple digit number in it.
  • 住所の見栄えを良くする為に、住所に複数桁数の数字が含まれている場合に、異なるテキスト設定を行ったフレームにて表示させたい

What you can achieve with this tip?


This tips make you able to display variable text in different text frame where you set different text formatting.(Although you can see text in each text frames in below screen shot, it is only for better understanding of differences between each Tips. By Using this VBScript, you can divide text frame for display customer address, especially depends on whether address contain any number larger than 100(3 digit) or not.)


Preview :

As you can see, the text frame in the right side(nogtips3) display entire of customer address by using “MOJI-TSUME” which is the menu only available on Japanese version of InDesign:-)
So you can see 3 digit number which looks use similar width than other single characters.



Please refer to former post of this series regarding basic setting.


  1. Create variables at outside of page layout. Those variables will be used for script.
  2. Create text frame for vertically scripting.
  3. Register all frames in DSM-Bridge as variable element.
    (Since this database has multiple column that each column has small part of recipient address. So I made another variable that can integrated 4 column that all records has value in it)
    Please refer to my last postregarding the assignment for Case1 and Case2.
  4. Setup for “nogtips_Multi_Digit_Address” :
    For this text frame, we set “MOJI-TSUME” with 100 as its value. So all text will be displayed by shrinking space beteen each character.(*This feature only available on Japanese version of Adobe InDesign)
  5. Edit VBScript
    Let’s edit vbscript. I made script that named as “Vertical Script3”. Here is the entire of script code.

    function VerticalScript3()
    	Dim address, s, t
    	Set address = new RegExp
    	address.pattern = *\d{3,}*
    'To control a using text frame more explictly, it force to false. Threrefore please change it to suit with you.
    	If address.Test(s) Then
    		Var.PutS "nogtips_Multi_Digit_Address", s
    		Var.PutS "nogtips_Multi_Digit_Address", ""
    	End If
    End function

    This script handles all text like below.
    It search if there is any number that larger than 3 digit by using Regular Expression. If it find any number that higher than 99, then it will assign a customer address to “nogtips_Multi_Digit_Address”. If not, then it assign just empty value.

  6. Layer Variable :
    To change display text frame depends on whether address contain multiple digit number in it, we set the condition for InDesign Layer. So layer that have a variable [[nogtips_Multi_Digit_Address]] will be used only when it match with condition.

  7. Edit variable property :
    The last thing and most important is to specify the order of variable process. If you don’t set it, or set wrong order, you will get unexpected result or simply it won’t work. Please set correct order depends on your variable assignment and script that you set.

    Here is the exactly order in this sample.
    ”Address” = 1
    “Case1″ = 2
    “Case2″ = 2
    “Case3″ = 2
    “Vertical Script” = 3
    “nogtips_Address” =4
    “Vertical Script 3” = 3
    “nogtips_Multi_Digit_Address” = 4

Output Preview