<commit_before>// batchTextEdit.jsx
// adobe Illustrator CSx script
// for editing the contents of the text frames all together.
//
// Usage:
// 1. Select the textframe(s) and run this script.
// 2. Edit the contents in the dialog. Then hit OK button.
//
// Notice:
// * The attribute of the first character is applied to whole
//   contents of textframe if you run this script for it.
//   It is assumed that each contents is plain text.
// 
// * For the multiline contents, the return code characters are
//   replaced to the alternative ones (default:"@/") in the dialog.
//   When applying the edited contents, they are replaced to
//   the return code. This means you can't use "@/" itself in the
//   contents. You can change it in the setting part of the script.
//
// * The order of the texts in the dialog depends on the rectangle
//   area surrounding each top-left corner of the selected textframes.
//   If the width of the area is greater than the height of it, the
//   order is from left to right. Otherwise from top to bottom.

// test env: Adobe Illustrator CS3, CS6 (Windows)

// Copyright(c) 2013 <NAME>
// https://github.com/shspage
// This script is distributed under the MIT License.
// See the LICENSE file for details.

main();
function main(){
	// - settings -------------
	// return code alternative character(s) used while editting
	const return_code_alt = "@/";

	// return code that used in regexp (escape the characters if it needs)
	const return_code_alt_for_rex = return_code_alt;

	// edittext size
	const edittext_width = 200;
	const edittext_height = 200;

	// - settings end -------------
	// ----------------------------
	if( app.documents.length < 1 ) return;

	// get textframes in the selection
	var tfs = []; // textframes
	extractTextFramesAsVTextFrameItem( app.activeDocument.selection, tfs );
	if( tfs.length < 1 ){
		aleft( "Please select textframes" );
		return;
	}

	// sort tfs
	sortVTextFramesReasonableByPosition( tfs );

	// get the contents of tfs
	var conts = [];
	var rex_return_code = new RegExp("\r", "g");
	for( var i=0; i < tfs.length; i++ ){
		conts.push( tfs[i].tf.contents.replace(
			rex_return_code, return_code_alt));
	}

	// show a dialog
	var win = new Window("dialog", "batchTextEdit");
	
	// add edittext
	var et_opt = { multiline:true, scrolling:true };
	var ver16 = ( app.version.substr(0, 2) > "15");
	if( ver16 ) et_opt.wantReturn = true;

	var et = win.add("edittext",[0, 0, edittext_width, edittext_height], "", et_opt);
	et.text = conts.join("\n");
	et.active = true;

	// add statictext
	var st_text = "* \"" + return_code_alt + "\" means a return code"
	if( !ver16 ) st_text += "\r* Use ctrl+enter for new line"<commit_msg>fixed a typo<commit_after>// batchTextEdit.jsx
// adobe Illustrator CSx script
// for editing the contents of the text frames all together.
//
// Usage:
// 1. Select the textframe(s) and run this script.
// 2. Edit the contents in the dialog. Then hit OK button.
//
// Notice:
// * The attribute of the first character is applied to whole
//   contents of textframe if you run this script for it.
//   It is assumed that each contents is plain text.
// 
// * For the multiline contents, the return code characters are
//   replaced to the alternative ones (default:"@/") in the dialog.
//   When applying the edited contents, they are replaced to
//   the return code. This means you can't use "@/" itself in the
//   contents. You can change it in the setting part of the script.
//
// * The order of the texts in the dialog depends on the rectangle
//   area surrounding each top-left corner of the selected textframes.
//   If the width of the area is greater than the height of it, the
//   order is from left to right. Otherwise from top to bottom.

// test env: Adobe Illustrator CS3, CS6 (Windows)

// Copyright(c) 2013 <NAME>
// https://github.com/shspage
// This script is distributed under the MIT License.
// See the LICENSE file for details.

main();
function main(){
	// - settings -------------
	// return code alternative character(s) used while editting
	const return_code_alt = "@/";

	// return code that used in regexp (escape the characters if it needs)
	const return_code_alt_for_rex = return_code_alt;

	// edittext size
	const edittext_width = 200;
	const edittext_height = 200;

	// - settings end -------------
	// ----------------------------
	if( app.documents.length < 1 ) return;

	// get textframes in the selection
	var tfs = []; // textframes
	extractTextFramesAsVTextFrameItem( app.activeDocument.selection, tfs );
	if( tfs.length < 1 ){
		alert( "Please select textframes" );
		return;
	}

	// sort tfs
	sortVTextFramesReasonableByPosition( tfs );

	// get the contents of tfs
	var conts = [];
	var rex_return_code = new RegExp("\r", "g");
	for( var i=0; i < tfs.length; i++ ){
		conts.push( tfs[i].tf.contents.replace(
			rex_return_code, return_code_alt));
	}

	// show a dialog
	var win = new Window("dialog", "batchTextEdit");
	
	// add edittext
	var et_opt = { multiline:true, scrolling:true };
	var ver16 = ( app.version.substr(0, 2) > "15");
	if( ver16 ) et_opt.wantReturn = true;

	var et = win.add("edittext",[0, 0, edittext_width, edittext_height], "", et_opt);
	et.text = conts.join("\n");
	et.active = true;

	// add statictext
	var st_text = "* \"" + return_code_alt + "\" means a return code"
	if( !ver16 ) st_text += "\r* Use ctrl+enter for new line"
{'fraction_non_alphanumeric': 0.13669197999629562, 'fraction_numerical': 0.010742730135210224, 'mean_word_length': 2.967670830271859, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4393570', 'n_tokens_mistral': 1751, 'n_tokens_neox': 1654, 'n_words': 653}