2008年2月20日水曜日

選択したオブジェクトのプロパティをテキスト保存

たまたま書けたスクリプト。これは使えるかも……
selObj = app.activeDocument.selection;
for (i=0; i<selObj.length; i++)
{
var pTextName="propaties"+"_"+(selObj.length-i);
var fileObj = new File("/"+pTextName+".txt");
var flag = fileObj.open("w");
if (flag){
fileObj.write(selObj[i].properties.toSource());
}
}

適当なオブジェクト(テキストフレームとか)を選択して実行すると、HD直下に「propaties_(番号).txt」を書き出す。開けてみるとこんな感じ。
({transparencySettings:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@transparency-settings"), strokeTransparencySettings:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@stroke-transparency-settings"), fillTransparencySettings:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@fill-transparency-settings"), contentTransparencySettings:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@content-transparency-settings"), geometricBounds:[76.5, 56, 119, 118], visibleBounds:[76.5, 56, 119, 118], parentStory:resolve("/document[@name=¥"名称未設定-1¥"]//story[@id=220]"), startTextFrame:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]"), endTextFrame:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]"), textFrameIndex:0, overflows:false, previousTextFrame:null, nextTextFrame:null, contents:"", textFramePreferences:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@text-frame-preferences"), anchoredObjectSettings:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@anchored-object-settings"), baselineFrameGridOptions:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@baseline-frame-grid-options"), textWrapPreferences:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@text-wrap-preferences"), contentType:1952412773, gridData:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@grid-data"), associatedXMLElement:null, overridden:false, overriddenMasterPageItem:null, fillColor:resolve("/document[@name=¥"名称未設定-1¥"]//swatch[@id=14]"), fillTint:-1, strokeWeight:0, miterLimit:4, endCap:1650680176, endJoin:1835691886, strokeType:resolve("/document[@name=¥"名称未設定-1¥"]/stroke-style[@id=23081]"), leftLineEnd:1852796517, rightLineEnd:1852796517, strokeColor:resolve("/document[@name=¥"名称未設定-1¥"]//swatch[@id=14]"), strokeTint:-1, cornerRadius:4.23333333333333, gradientFillStart:[87, 97.75], gradientFillLength:0, gradientFillAngle:0, gradientStrokeStart:[87, 97.75], gradientStrokeLength:0, gradientStrokeAngle:0, gapColor:resolve("/document[@name=¥"名称未設定-1¥"]//swatch[@id=14]"), gapTint:-1, strokeAlignment:1936998723, nonprinting:false, itemLayer:resolve("/document[@name=¥"名称未設定-1¥"]//layer[@id=196]"), locked:false, localDisplaySetting:1147563124, allPageItems:[], allGraphics:[], rotationAngle:0, shearAngle:0, horizontalScale:100, verticalScale:100, absoluteRotationAngle:0, absoluteShearAngle:0, absoluteHorizontalScale:100, absoluteVerticalScale:100, frameFittingOptions:resolve("/document[@name=¥"名称未設定-1¥"]//text-frame[@id=238]/@frame-fitting-options"), flip:1852796517, absoluteFlip:1852796517, cornerOption:1852796517, appliedObjectStyle:resolve("/document[@name=¥"名称未設定-1¥"]//object-style[@id=135]"), lockState:1852796517, id:238, label:"", parent:resolve("/document[@name=¥"名称未設定-1¥"]//page[@id=204]"), index:0})

ずら〜りとプロパティの値が。
これでもう手探りでプロパティを探さなくてすむよ。

0 件のコメント: