View sampleSUIProgressBar.jsx
This file contains 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
#targetengine session | |
var fonts = app.fonts; | |
var fontLength = fonts.length; | |
var fontList = []; | |
var dlg = new Window("palette"); | |
dlg.add("staticText", undefined, "フォントを読み込んでいます..."); | |
dlg.alignChildren = "fill"; | |
var pb = dlg.add("progressbar", undefined, 0, fontLength); |
View exportCompFontProp.jsx
This file contains 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() { | |
var doc = app.activeDocument; | |
var compFonts = doc.compositeFonts; | |
var result = []; | |
for (var k=1; k<compFonts.length; k++) { | |
result.push("# " + compFonts[k].name); | |
var cfEnt = compFonts[k].compositeFontEntries; | |
for (var i=0; i<cfEnt.length; i++) { | |
result.push("## " + cfEnt[i].name); | |
result.push("* フォント:"+cfEnt[i].appliedFont+"/"+cfEnt[i].fontStyle); |
View reviealOverlappedPstylename.jsx
This file contains 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
var doc = app.activeDocument; | |
var pst = doc.allParagraphStyles; | |
pst.splice(0, 2); | |
var pstNameList = getNames(pst); | |
var result = {}; //エラー結果を入れる配列 | |
for (var i=0, ilen=pstNameList.length; i<ilen; i++) { | |
for (var k=0, klen=pstNameList.length; k<klen; k++) { | |
if (i === k) { | |
continue; |
View pasteOnSamePlaceAftSpread.jsx
This file contains 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 (){ | |
//状態チェック | |
if (app.documents.length === 0) { | |
alert("ドキュメントを開いてから実行してください"); | |
return; | |
} | |
if (app.selection.length === 0) { | |
alert("オブジェクトを選択してから実行してください"); | |
return; | |
} |
View array_filter.jsxinc
This file contains 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
// Production steps of ECMA-262, Edition 5.1, 15.4.4.20 | |
// https://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.20 | |
// from http://javascript.boxsheep.com/polyfills/Array-prototype-filter/ | |
if (!Array.prototype.filter) { | |
Array.prototype.filter = function(callbackfn , thisArg) { | |
"use strict"; | |
var O = Object(this), | |
lenValue = O.length, | |
len = lenValue >>> 0, | |
T, |
View exportNestedGrepStyleExpressions.jsx
This file contains 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
var doc = app.activeDocument; | |
var pst = doc.allParagraphStyles; | |
var len = pst.length; | |
var tgtFolder = Folder.selectDialog("書き出し先のフォルダを選択"); | |
for (var i=1; i<len; i++) { | |
if (pst[i].parent.constructor.name === "ParagraphStyleGroup") { | |
exportTxtFile(pst[i].parent.name+" >>> "+pst[i].name, getNestedStylesExp(pst[i])); | |
} else { | |
exportTxtFile(pst[i].name, getNestedStylesExp(pst[i])); | |
} |
View addTextFromUnicode.jsx
This file contains 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
var doc = app.activeDocument; | |
var sel = doc.selection[0]; | |
var startChar = parseInt("21", 16); //入力する文字の最初のコードポイント | |
var endChar = parseInt("24ff", 16); //入力する文字の最後のコードポイント | |
app.doScript(function(){ | |
while(startChar < endChar) { | |
sel.contents += String.fromCharCode(startChar); | |
startChar++; | |
} | |
}, ScriptLanguage.JAVASCRIPT, null, UndoModes.ENTIRE_SCRIPT); |
View replaceLastObject.jsx
This file contains 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
var doc = app.activeDocument; | |
var sel = doc.selection; | |
var tgt = sel[sel.length-1]; | |
var newSelection = []; | |
app.doScript(main, ScriptLanguage.JAVASCRIPT, null, UndoModes.ENTIRE_SCRIPT); | |
function main(){ | |
var tempRuler = doc.viewPreferences.rulerOrigin; | |
doc.viewPreferences.rulerOrigin = RulerOrigin.SPREAD_ORIGIN; | |
for (var i=sel.length-2; i>=0; i--) { |
View Code.gs
This file contains 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
var nsDefault = XmlService.getNamespace("urn:yahoo:jp:jlp:FuriganaService"); | |
function parseXml() { | |
var url = 'http://jlp.yahooapis.jp/FuriganaService/V1/furigana'; | |
var params = [ | |
'appid=XXXXXXXXXXXXXXXXXXXX', | |
'sentence=' + encodeURIComponent('初音ミクさんを忘れないでください'), | |
'grade=1' | |
] | |
var xml = UrlFetchApp.fetch(url + '?' + params.join('&') ).getContentText(); |
View array_some.js
This file contains 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
// Production steps of ECMA-262, Edition 5, 15.4.4.17 | |
// Reference: http://es5.github.io/#x15.4.4.17 | |
if (!Array.prototype.some) { | |
Array.prototype.some = function(fun/*, thisArg*/) { | |
'use strict'; | |
if (this == null) { | |
throw new TypeError('Array.prototype.some called on null or undefined'); | |
} | |