View ind_idml_break_composite_font_entries.jsx
//@target indesign
// 合成フォントを含むidmlをひらくと、すでにひらいているinddの同名合成フォント情報まで破壊する
app.documents.everyItem().close(SaveOptions.NO)
var indd_file = File(Folder.desktop + "/foo.indd")
var idml_file = File(Folder.desktop + "/foo.idml")
var doc = app.documents.add()
doc.save(indd_file)
View ind_set_anchor_before_fit.jsx
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
var img = obj.place(File(file_path));
// set anchor
obj.frameFittingOptions.fittingAlignment = AnchorPoint.CENTER_ANCHOR;
// fit
img[0].fit(FitOptions.CENTER_CONTENT);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
View toggle_target_display_mode.scpt
tell application "System Events"
key code 122 using command down # Cmd-F2
end tell
View rescue_application_frame.applescript
-- rescue untouchable application frame
tell application "Adobe InDesign CC"
set rescue_bound to {32, 0, 400, 400}
if not use application frame of general preferences then
set use application frame of general preferences to true
end if
if not exists active window then
make new document
View ind_find_top_level_group.jsx
//@target "indesign"
var sel = app.selection[0];
var ret = find_parent(sel, 'Group');
function find_parent (obj, constructor) {
if (obj.parent.parent.constructor.name !== constructor) {
return obj.parent
}
else {
return arguments.callee(obj.parent, constructor);
View ind_bug_pathpoint_anchor_handling.jsx
/*
フレーム内マージンが設定されたテキストフレーム
のアンカーの位置を操作するとマージン分余計に動いてしまう
*/
var test = function (doc, opts) {
var textframe = doc.textFrames.add({
geometricBounds: opts['frame_bon']
});
// フレーム内マージン!!!
View ind_read_with_guess.jsx
//@target "indesign"
var read_with_guess = function (path, encoding) {
var f = File(path);
f.encoding = encoding || "cp932";
if (f.open("r")) {
var r = f.read();
// TODO regexp pattern
if (r.match(/[縲縺繧翫]+/)) {
View ind_possible_to_create_zero_height_cell.jsx
//@target "indesign"
$.writeln(app.version);
var doc = app.documents.add();
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var tf = doc.textFrames.add({geometricBounds:[10,10,50,100]});
var tbl = tf.tables.add({bodyRowCount:4, columnCount:4});
var cr= tbl.rows[0];
r.autoGrow = false;
View ind_cell_min_width_change_from_cs6_pt.jsx
//@target "indesign"
$.writeln(app.version);
var doc = app.documents.add();
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var tf = doc.textFrames.add({geometricBounds:[10,10,50,100]});
var tbl = tf.tables.add({bodyRowCount:4, columnCount:4});
var c = tbl.columns[0];
var i = 4;
while (i-=0.0001) {
View ind_cell_min_width_change_from_cs6_mm.jsx
//@target "indesign"
$.writeln(app.version);
var doc = app.documents.add();
app.scriptPreferences.measurementUnit = MeasurementUnits.MILLIMETERS;
var tf = doc.textFrames.add({geometricBounds:[10,10,50,100]});
var tbl = tf.tables.add({bodyRowCount:4, columnCount:4});
var c = tbl.columns[0];
var i = 2;
while (i-=0.0001) {