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
#target "Illustrator" | |
function mergedBounds(bns,nowBns){ | |
if(!bns){ | |
bns=nowBns; | |
}else{ | |
if(nowBns){ | |
if(bns[0]>nowBns[0])bns[0]=nowBns[0]; | |
if(bns[1]<nowBns[1])bns[1]=nowBns[1]; | |
if(bns[2]<nowBns[2])bns[2]=nowBns[2]; |
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
//項目がリストに含まれているかどうか | |
assert ['神川','伊藤','山田','篠原','田口'].contains('伊藤') | |
//list内すべての項目があるかどうか調べる | |
assert [2, 5, 8, 12, 16].containsAll([2,8,12]) | |
assert [2, 5, 8, 12, 16].containsAll([2,8,13])==false | |
//リストの項目がかぶっていないか調べる | |
assert ['神川','伊藤'].disjoint(['山田','篠原','田口']) |
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
/* | |
fitimage_ind.jsx | |
画像の幅と高さを取るサンプル | |
画像をフィットさせるサンプル | |
※ピクセルサイズを取るのはInDesignでは無理 | |
*/ | |
//画像の入ったフレームを選択 | |
var sel=app.activeDocument.selection[0]; | |
//中の画像 |
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
/** | |
* @fileOverview 開いているInDesignドキュメントを順番にPDFX/1aで保存して閉じます。<br> | |
* <b>使い方</b>:<br> | |
* (1)InDesignドキュメントを複数開き(必ず保存して下さい)スクリプトを実行します。<br> | |
* (2).inddファイルと同階層にPDFを保存し、閉じます。<br> | |
* (3)開いているファイルがすべて閉じたら、「pdfを書き出しました」というアラートが表示されます。<br> | |
* | |
* @author Kanemu | |
* @version 0.1 | |
*/ |
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
//InDesign そのアイテムの持つドキュメントを取る | |
function parentDoc(obj){ | |
var sp=obj.toSpecifier().split('/'); | |
if(sp.length<2||!/^document/.test(sp[1]))return; | |
return resolve(sp.slice(0,2).join('/')); | |
}; | |
//InDesign そのアイテムの持つドキュメントを取る(再帰) | |
function parentDoc2(obj){ | |
var parent=obj.parent; |
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
#target "InDesign" | |
var basedOnEnum=(function(){ | |
//ExtendScript Toolkitのヘルプファイルへのパス。InDesignCS3、Macの場合 | |
var xmlPath="~/Library/Preferences/ExtendScript Toolkit/2.0/omv$indesign-5.0-ja_jp.xml"; | |
var openFile=new File(xmlPath); | |
if(!openFile.open ("r")) return undefined; | |
var src=openFile.read(); | |
var myXml = new XML(src); | |
var node=myXml.xpath("/dictionary/map/topicref[@navtitle=\"Enum Suite\"]/topicref[@navtitle]"); | |
//$.writeln(node); |
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 "logging" | |
var timeStamp = function(d){ | |
var i,ary; | |
if(!d){ d = new Date() }; | |
ary = [ | |
d.getFullYear(),(d.getMonth()+1),d.getDate(), | |
d.getHours(),d.getMinutes(),d.getSeconds() | |
]; | |
for(i=0,len=ary.length;i<len;i++){ |
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
#target "Illustrator" | |
(function(){ | |
//ドキュメントが開いていなければ抜ける | |
if(app.documents.length==0) return; | |
//開いているドキュメントを指定 | |
var doc=app.activeDocument; | |
//選択項目がなければ抜ける | |
if(doc.selection.length==0) return; | |
//選択項目のひとつめを指定 |
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
String str = 'Hello,1717です。' | |
str = str.replaceAll(/[\uff01-\uff5e]/){new String((char)(((int)it)-65248))} | |
assert str=='Hello,1717です。' |
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
// g100pon #32 文字コード判定 | |
import com.ibm.icu.text.CharsetDetector | |
@Grab(group='com.ibm.icu', module='icu4j', version='4.0.1') | |
def detector = new CharsetDetector() | |
//ファイルは先に用意してあります... | |
//ISO-2022-JP | |
def bytes1 = new File('/works/test/iso2022-jp.txt').getBytes() | |
def name1 = detector.setText(bytes1).detect().getName() |
NewerOlder