Quantcast
Channel: Adobe Community: メッセージ リスト - InDesignコミュニティフォーラム (Japan)
Viewing all articles
Browse latest Browse all 5079

Re: java script‐「GetTrackchange」について

$
0
0

これでどうでしょうか。

 

#target indesign
#targetengine "session" 
(function () {    function getChanges (stories) {        var changes = [];        for (var i = 0, storiesLength = stories.length; i < storiesLength; i++) {            var story = stories[i];            Array.prototype.push.apply(changes, story.changes);            var tables = story.tables;            for (var j = 0, tablesLength = tables.length; j < tablesLength; j ++) {                Array.prototype.push.apply(changes, tables[j].changes);            }        }        return changes;    }    function selectItem (item, activePage, zoom) {        app.activeDocument.select(item);        if (activePage) app.activeWindow.activePage = activePage;        if (zoom) app.activeWindow.zoomPercentage = zoom;    }    (function () {        var changes = getChanges(app.activeDocument.stories);        if (changes.length === 0) {            alert("変更が見つかりません");            return;        }        var index = -1;        window = new Window("window", "");        stext = window.add("StaticText", [0, 0, 100, 20], "");        stext.justify = "center";        var group1 = window.add("Group");        group1.orientation = "row";        var prevButton = group1.add("Button", undefined, "前の変更箇所");        var nextButton = group1.add("Button", undefined, "次の変更箇所");        var group2 = window.add("Group");        group2.orientation = "row";        var zoomCheck = group2.add("CheckBox", undefined, "ズーム表示");        var zoomList = group2.add("DropDownList", [0, 0, 100, 20]);        zoomList.enabled = false;        zoomList.add("item", "50%");        zoomList.add("item", "100%");        zoomList.add("item", "200%");        zoomList.add("item", "500%");        zoomList.selection = 3;        zoomCheck.onClick = function () {            if (zoomCheck.value) zoomList.enabled = true;            else zoomList.enabled = false;        };        var select = function (index) {            stext.text = (index + 1) + " / " + changes.length;            var zoom = (zoomCheck.value) ? parseInt(zoomList.selection.text.replace("%", "")) : false;            var change = changes[index];            selectItem(change.storyOffset, change.storyOffset.parentTextFrames[0].parentPage, zoom);        };        prevButton.onClick = function () {            index -= 1;            if (index === -1 || index < 0) index = changes.length - 1;            select(index);        };        nextButton.onClick = function () {            index += 1;            if (index === -1 || index >= changes.length) index = 0;            select(index);        };        window.show();    }());}());

Viewing all articles
Browse latest Browse all 5079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>