This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function read_text_file (file) { | |
if(file !=null) { | |
var all_string = ""; | |
file.open("r"); | |
while(!file.eof) { | |
all_string += (file.readln() + "\n") ; | |
}; | |
file.close(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function remove_see_see_also ( text ) { | |
var tmp_str = ""; | |
var my_reg = new RegExp("(^see also )|(^see )|(\t000$)","g"); | |
tmp_str = text.replace(my_reg, ""); | |
// remove unvisible xml tag | |
var xml_tag_char = ""; | |
xml_tag_char = tmp_str.charCodeAt(0); | |
if(xml_tag_char === 65279){ | |
tmp_str = tmp_str.replace(tmp_str[0],""); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find_by_grep (grep_keyword, paragraph_style, app_document) { | |
var app_doc = app_document || app.activeDocument; | |
app.findChangeGrepOptions.includeLockedLayersForFind = false; | |
app.findChangeGrepOptions.includeLockedStoriesForFind = false; | |
app.findChangeGrepOptions.includeHiddenLayers = false; | |
app.findChangeGrepOptions.includeMasterPages = false; | |
app.findChangeGrepOptions.includeFootnotes = false; | |
// app.findChangeTextOptions.caseSensitive = true; | |
// app.findChangeTextOptions.wholeWord = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filter_files (param_files, file_name_part) { | |
var all_files = param_files || []; | |
var selected_files = []; | |
var my_reg = new RegExp(file_name_part); | |
if(all_files.length === 0 ) {return [];} | |
for (var i = 0, len = all_files.length; i < len; i++) { | |
if(my_reg.test(all_files[i].name)) { | |
selected_files.push(all_files[i]); | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_folder_files(file_type, title, param_path) { | |
// v.0.1.2 | |
var path = ""; | |
if(!param_path) { | |
var tmp_file = File.openDialog(title, file_type); | |
if(!tmp_file) {exit(); }; | |
path = tmp_file.path; | |
}else { path = param_path; }; | |
var my_folder = new Folder(path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function index_progress_bar(title) { | |
var w = new Window("palette", title, undefined); | |
w.orientation = "column"; | |
var text_group = w.add("group"); | |
text_group.orientation = "column"; | |
var file_name = text_group.add("statictext", [0,0,350,20], "calculating.."); | |
var remain = text_group.add("statictext", [0,0,350,20], "Remain: .."); | |
text_group.alignChildren = "left"; | |
var progressbar = w.add("progressbar", undefined, 0, 100); | |
progressbar.preferredSize = [350,20]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function in_library (library_string, name) { | |
var my_reg_exp = new RegExp( "::" + remove_file_extension(name) + "::" ); // use separation symbol | |
var result = false; | |
if(my_reg_exp.test( library_string )) { | |
result = true; | |
}; | |
return result; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_lib_index_dialog() { | |
// v 0.1.2 tested. | |
var library_name = ""; | |
var all_library_names = []; | |
var my_index = -1; | |
for (var i = 0, len = app.libraries.length; i<len;i++) { | |
all_library_names.push(remove_file_extension(app.libraries[i].name).toUpperCase()); | |
}; | |
if(all_library_names.length ===1){return 0;} | |
if(all_library_names.length>1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function build_library_string(param_library_index) { | |
// v.0.1.1 no library or asset return "" | |
var library_index = param_library_index || 0 ; | |
var my_library = app.libraries[library_index]; | |
var library_assets = my_library.assets; | |
var str = ""; | |
if (app.libraries.length==0) {alert("There's no library."); return "";}; | |
if (library_assets.length==0) {alert("There's no asset in the library."); return "";}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function join_page_string (pages, symbol_first, symbol_last) { | |
var page_string = ""; | |
if( pages.length === 1 ) { return pages.toString();} | |
for (var i = 0, len = pages.length; i < len; i++) { | |
if(i < len-1) { | |
page_string += pages[i]; | |
if( i != len-2 ) { page_string += symbol_first} | |
}else { | |
page_string += (symbol_last + pages[i]); | |
}; |