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

nogtips --- Vertical Scripting Tips 4 ---
This is #4 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.

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

また、宛名の縦組みに関する基本方法は過去の投稿「宛名の縦書き」を参照して下さい。

How to lay out the recipient name looking nicely when it should be joint signature.

宛名の連名表記を見栄え良く表示する方法

This tips if for user who have below request.
このTipsは以下の様な要望をお持ちのユーザー向けです。

  • Lay out multiple recipient name looks nicely, especially when the database contain not only full name, but also only first name as second name that should be displayed.
  • 氏名・名のみなどのレコードが混在するデータベース使用時に、宛名の連名表記を見栄え良く表示したい

Preview of the problematic text display :
問題点の画像プレビュー:

Vertical Scripting Tips 4 Preview 1

Preview 1 : Full Name for main recipient and Full Name for second recipient.
As you can see, it’s no problem at all. Both text fit into text frame, and was adjusted accordingly by Adobe InDesign text frame setting.

プレビュー1:メインの宛名が氏名、連名も氏名の場合
ご覧のとおり、何の問題もありません。どちらの宛名もAdobe InDesignのテキストフレームの設定に従って表示されています。

Vertical Scripting Tips 4 Preview 2

Preview 2 : Full Name for main recipient and only First Name for second recipient.
As you can see, it looks not nice, especially for second recipient’s name. It because this text frame have been set with “Full Justification” in vertically.

プレビュー2:メインの宛名が氏名で、連名が名前のみの場合
御覧いただける通り、連名用の名前が両端揃えにて表示されているので、見栄えが良くありません。

Vertical Scripting Tips 4 Preview 3

Preview 3 : Full Name for main recipient and only First Name for second recipient. (nogtips version)
This looks much better than above one. So we added additional space key in front of second recipient’s first name. So it start to describe her name almost same position of mail recipient’s first name.

プレビュー3:メインの宛名が氏名、連名も氏名の場合(nogtips使用バージョン)
御覧いただける通り、連名の名前がメインの宛名の苗字部分より下がって表示されているので、より見栄えが良くなっています。

What you can achieve with this tip?

このTipsで何が出来るのか?

This tips make you able to display a join signature with nice-looking. Especially, when your database contain second name that should be a part of the joint signature as recipient name even those name is full-name, or just only first name.(It because if you assign the second name to text frame, the looking of those text frame is not good when it only have first name, because it will start to describing from the top, although other name start from Last name + First name)

本Tipsを使用すると、宛名の連名表記をするにあたり、データベースに二番目の方の名前が「氏名(フルネーム)」または「名前のみ」といった値が混在する場合に、単一のテキストフレームへのテキストの流しこみをす事による見栄えの崩れを防げ、連名であっても見栄え良く表記する事が可能になります。

Preview :
プレビュー:

Vertical Scripting Tips 4 Preview 4
With this tips, even your database contain both type of name as second recipient name(Full name or only First name), it can display the recipient name with nice-looking.

このTipsを使用すると、例えデータベースのレコードが連名用の項目に「氏名」または「名前のみ」といった値が混在している場合でも、一括処理が可能になり、また見栄えを良くすることが可能になります。

Setup
設定方法

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.
    ページのレイアウト範囲外にスクリプトで使用するためのバリアブルを作成します。
    Actual database looks like below.
    実際に使用しているデータベースは以下の通りです。
    Vertical Scripting Tips 4 Database
  2. Create text frame for vertically scripting.
    宛名用に縦組みのテキストフレームを作成します。Vertical Scripting Tips 4 Text Frame 1

    You should check maximum characters that can be displayed vertically by this text frame. I checked it by using “circle” instead of typing character. And this text frame can display 10 characters as vertical maximum number.(It’s just for checking, so you can remove those circles after you check it)With this text frame, you need to set “Full Justification” as type setting.

    宛名用のテキストフレームを作成する際は、最大何文字まで縦組みにて表記出来るのかをチェックします。今回は「○」を使用して文字数のチェックをしています。このテキストフレームには縦組みにて最大10文字表記することが可能です。

    Vertical Scripting Tips 4 Text Frame 2

  3. Register all frames in DSM-Bridge as variable element.
    全てのバリアブル項目をDSM-Bridgeに登録する。
  4. Setup for each variables :
    All variable should have assignment like below.

    バリアブル項目への割り当て:
    以下の様に割り当てを行います。

    [[Full_Name]]
    Vertical Scripting Tips 4 Variable Assignment - FullName

    [[Name1]]
    Vertical Scripting Tips 4 Variable Assignment - Name1
    Because both of them will be used as recipient name, so I addes “様” as title oh honor in the end of their name.

    これらのバリアブル項目は実際に宛名用のテキストフレームにて使用する値となるので、宛名用に最後に「様」を追加します。

  5. Edit VBScript
    Let’s edit vbscript. I made script that named as “Vertical Script3”. Here is the entire of script code.

    VBスクリプトの編集:
    それではVBスクリプトを編集します。今回は以下のようにしました。
    Vertical Scripting Tips 4 Variable Assignment -VBScript

    function JointSignatureScript()
    	Dim firstName, secondName, secondWithSal, spacekey, Cnt, work, work2, aspace, secondFullText
    	firstName = RS("氏名")
    	secondWithSal = RS("連名用")
    	spacekey=" "
    	Cnt=Len(firstName)
    	work=InStr(firstName, spacekey)
    	work2 = InStr(secondName, spacekey)
    	If work2 <> 0 Then
    		Var.PutS "JSign01", secondWithSal
    		JointSignatureScript = secontWithSal
    	Else
    		aspace = String(work, spacekey)
    		secondFullText = aspace & secondWithSal
    		Var.PutS "JSign01", secondFullText
    		JointSignatureScript = secondFullText
    	End If
    End function
    
  6. 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.
    バリアブルのプロパティ設定を行う:
    最後にして、一番重要なTipsはバリアブルに対する「値を受け取る順序設定」です。この設定が正しくない、正しい順序で設定されていない場合は、予期せぬ表示結果を得る可能性があります。ですので、確実に順序立てて値を受け取れるように各バリアブルに対してプロパティを設定していきます。Vertical Scripting Tips 4 Process Order -VBScript
    Vertical Scripting Tips 4 Process Order -Recipient Name -TextFrame

    Here is the exactly order in this sample.
    各バリアブルの値を受け取る順序設定は以下の通りです。

    “Full_Name” = 1
    “Name1” = 1
    “Script” = 2
    “JSgin01” = 3

Output Preview
出力プレビュー

Vertical Scripting Tips 4 Output PDF Preview

広告

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.

[JP]
これは宛名の縦組みに関する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.
このTipsは以下の様な要望をお持ちのユーザー向けです。

  • 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?

このTipsで何が出来るのか?

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.)

本Tipsを使用すると、以下の様に複数桁数を含む住所を処理する際に別のテキストフレームにて表示する事が可能です。(それぞれのTipsによる表示結果の差異を明示する為に全てのテキストフレームに住所を表示させていますが、実際にこのTipsを使用した場合には、住所が3桁以上の連続する数値を含む場合にのみ、ターゲットのテキストフレームに住所を表示させる事が可能です。レイヤー・バリアブルと併せて使用することで、表示するテキストフレームを変更出来ます。)

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.

ご覧のとおり、一番右の今回のTipsを適用したテキストフレームでは、文字に「文字ツメ」の効果がかかっており、連続する3桁以上の数を表示するにあたっても、別の数値と近い文字幅にて表示しています。

Setup
設定方法

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.
    全てのテキストフレームをDSMブリッジへ登録します。
    (本Tipsは複数の項目にて住所情報を保存しているDBの使用を想定しています。ですので、始めにある程度住所情報を結合して表示するための代替用バリアブル項目([[Address]])を作成しています。またこのバリアブルへの割り当て設置段階で、ハイフン「-」を全角マイナス「ー」に置き換える設定を行います。詳細についてはTips第1弾を参照して下さい)
  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)
    バリアブル[[nogtips_Multi_Digit_Address]]の設定:
    このテキストフレームは「文字ツメ」効果を設定し、テキストが詰まって表示されるように設定します。これにより、複数桁数の数値を縦中横で表示する際でも、ある程度全体の文字幅を縮めて表示する事が可能になります。
  5. Edit VBScript
    Let’s edit vbscript. I made script that named as “Vertical Script3”. Here is the entire of script code.
    VBスクリプトの編集:
    それではVBスクリプトを編集します。今回は以下のようにしました。

    function VerticalScript3()
    	Dim address, s, t
    	S=Var.GetS("Case2")
    	Set address = new RegExp
    	address.pattern = *\d{3,}*
    
    '今回は明示的に表示するフレームを変更する方法を取るので以下条件に合わない場合Falseとしていますが、適宜変更してください。
    '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
    		VerticalScript3=True
    	Else
    		Var.PutS "nogtips_Multi_Digit_Address", ""
    		VerticalScript3=False
    	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.
    正規表現を使って住所に3桁以上の数値が含まれている場合にのみ、バリアブル[[nogtips_Multi_Digit_Address]]に対して住所を割り当てます。それ以外の場合は空の値を割り当てます。

  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.
    バリアブルのプロパティ設定を行う:
    最後にして、一番重要なTipsはバリアブルに対する「値を受け取る順序設定」です。この設定が正しくない、正しい順序で設定されていない場合は、予期せぬ表示結果を得る可能性があります。ですので、確実に順序立てて値を受け取れるように各バリアブルに対してプロパティを設定していきます。

    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
出力プレビュー

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

This is #2 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.

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

また、宛名の縦組みに関する基本方法は過去の投稿「宛名の縦書き」を参照して下さい。

How to assign text with size specification when it should contain several size formatting?

同一フレームに対して割り当てるテキストを、サイズを変更した物と変更してない物で使い分け方

This tips if for user who have below request.
このTipsは以下の様な要望をお持ちのユーザー向けです。

  • Need to display customer address with different size formatting on first line and second line(Only when it require line feed. No need to change the text size when it can display in one line)
  • 改行を要する場合に、二行目のテキストサイズを変更したい。但し、二行目のテキスト数が少ない場合はサイズ変更せず、ある程度のテキスト数を超えた場合にのみサイズを小さくして表示したい。

What you can achieve with this tip?

このTipsで何が出来るのか?

This tips make you able to display variable text with different size on second line when it insert line feed in it.

本Tipsを使用すると、以下の様な改行を含む宛名表記に際して、一行目と二行目のテキストサイズを自動的に変更する事が可能になります。

Preview :
プレビュー:

As you can see in right side text frame, with this script, it can display text not only by inserting line feed when it  need multiple line, but also it can change the size of second line depends on the text length.

ご覧のとおり、本Tipsを使用したケースでは改行を挿入するだけでなく、改行後に続く行に表示されるテキストのサイズを変更する事が可能です。また、このテキストサイズの変更は二行目のテキストの文字数に応じて自動的に変更されるので、少ないテキスト数の場合はサイズ変更せずに二行目を表示します。

Setup
設定方法

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.
    全てのテキストフレームをDSMブリッジへ登録します。
    (本Tipsは複数の項目にて住所情報を保存しているDBの使用を想定しています。ですので、始めにある程度住所情報を結合して表示するための代替用バリアブル項目([[Address]])を作成しています。またこのバリアブルへの割り当て設置段階で、ハイフン「-」を全角マイナス「ー」に置き換える設定を行います。詳細についてはTips第1弾を参照して下さい)
  4. “Setup for Case3” :
    Open assignment window, and insert additional field in front of assigned database column which should be used in second line. Then specify the font size by using “Font” menu.
    バリアブル[[Case3]]の設定 :
    割り当てウィンドウを開き、二行目に使用するDB項目の割り当て直前に割り当てフィールドを追加します。(フィールドを選択し、右クリックメニューから新規フィールドの挿入が可能です) 次に、挿入したフィールドにて「フォント」タブをクリックし、サイズの指定を行います。ここではサイズオプションを有効化し、サイズに10ptを指定しました。ここでは有効にしていませんが、チェックボックスにチェックを入れる事で、サイズ同様にフォントの種類、色の変更も可能です。
  5. Edit VBScript
    Let’s edit vbscript. I made script that named as “Vertical Script”. Here is the entire of script code.
    VBスクリプトの編集:
    それではVBスクリプトを編集します。前回紹介したVerticalScriptを改変し、以下の様なスクリプトを記述します。

    function VerticalScript()
    	Dim Count
    	Dim Count2
    	Dim Work
    	Dim Work2
    	Dim s
    	Dim t
    		s = Var.GetS("Case1")
    		t = Var.GetS("Case2")
    		u = Var.GetS("Case3")
    		Count = Var.GetS("Case1")
    		Count2 = Var.GetS("Line2")
    		Work = Len(Count)
    		Work2 = Len(Count2)
    		If Work > 19 Then
    			If Work2 > 10 Then
    				Var.PutS "nogtips_Address", u
    			Else
    				Var.PutS "nogtips_Address", t
    			End If
    		Else
    			Var.PutS "nogtips_Address", s
    		End If
    			VerticalScript = Work
    End function
    

    This script handle all text like below.
    If entire address have more than 19 character, and second line has more than 10 character, then it use small size of text for second line. If not, use normal size.
    If entire text less than 20, then use normal size in one line.このスクリプトにより、住所としての文字列全体が19文字を超える場合は、次に二行目のテキストの文字数をカウントし、二行目が10文字以上の場合にはテキストサイズを10ptに変更させます。それ以外の場合はサイズ変更なしの二行目表示となり、そもそも一行で表示可能なテキスト数の場合は、一行で表示させます。

  6. Edit variable property :
    The last thing and most important is to specify the order of variable process. If you didn’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.
    バリアブルのプロパティ設定を行う:
    最後にして、一番重要なTipsはバリアブルに対する「値を受け取る順序設定」です。この設定が正しくない、正しい順序で設定されていない場合は、予期せぬ表示結果を得る可能性があります。ですので、確実に順序立てて値を受け取れるように各バリアブルに対してプロパティを設定していきます。


    Here is the exactly order in this sample.

    各バリアブルの値を受け取る順序設定は以下の通りです。

    ”Address” = 1
    “Case1″ = 2
    “Case2″ = 2
    “Case3” = 2
    “Vertical Script” = 3
    “nogtips_Address” =4

    Output Preview
    出力プレビュー