Skip to content

Instantly share code, notes, and snippets.

! /true/.test(String(app.activeDocument.stories.everyItem().overflows)) && app.activeDocument.stories.everyItem().createOutlines();
@moluapple
moluapple / gist:1133311
Created August 9, 2011 03:04
[Indesign] Table Stroke Fixer
var oTable = app.selection[0].parent.parent,
oRows = oTable.rows,
i = 0,
len = oRows.length;
for (; i < len; i++) {
oRows[i].cells[0].insertionPoints[0].endBaseline < oRows[i - 1].cells[0].insertionPoints[0].endBaseline
&& oRows[i - 1].rowSpan < 2
&& (oRows[i - 1].bottomEdgeStrokeWeight = oRows[i].topEdgeStrokeWeight = oRows[0].topEdgeStrokeWeight);
}
@moluapple
moluapple / gist:1134174
Created August 9, 2011 14:24
[Indesign] Fill Blank Cells
var oCells = app.documents[0].stories.everyItem().tables.everyItem().cells.everyItem().getElements(),
len = oCells.length,
i = 0;
for (; i < len; i ++){
oCells[i].contents == "" && oCells[i].contents = "-";
}
@moluapple
moluapple / gist:1148519
Last active September 26, 2015 19:37
[Photoshop] Text Contents Collector
(function () {
function layersText(oDoc) {
var oLayers = oDoc.layers, text = [], i, j, file;
function getTextLayers(oLayers, i) {
for (i = 0; i < oLayers.length; i++) {
oLayers[i].layers ? getTextLayers(oLayers[i].layers, j) : oLayers[i].kind == LayerKind.TEXT && text.push(oLayers[i].textItem.contents);
}
}
getTextLayers(oLayers, i);
file = new File(String(oDoc.fullName).replace(/(psd|tiff?)$/i, 'txt'));
@moluapple
moluapple / AI_deleteUnusedSwatches.jsx
Created August 22, 2011 13:33
[Illustrator] Delete Unused Swatches
//only for mark. For work, use John Wundes's script please.
//http://www.wundes.com/JS4AI/delete_fluff.js
function deleteUnusedSwatches (doc) {
var items = doc.pageItems,
len = items.length,
sw = doc.swatches,
slen = sw.length,
arr = [],
str = null,
@moluapple
moluapple / gist:1167366
Created August 24, 2011 05:29
[ESTK] windows_environment_variables
var environVar = ["ALLUSERSPROFILE", "PROGRAMDATA", "APPDATA", "COMPUTERNAME", "COMMONPROGRAMFILES", "COMMONPROGRAMFILES(x86)", "COMSPEC", "HOMEDRIVE", "HOMEPATH", "LOCALAPPDATA", "LOGONSERVER", "PATH", "PATHEXT", "PROGRAMFILES", "PROGRAMFILES(X86)", "PROMPT", "SystemDrive", "SystemRoot", "TEMP", "USERDOMAIN", "USERNAME", "USERPROFILE", "WINDIR", "PUBLIC", "PROGRAMDATA", "PSModulePath", "PROCESSOR_ARCHITECTURE", "PROCESSOR_ARCHITEW6432"],
i = 0, len = environVar.length;
for (; i< len; i++){
$.writeln(environVar[i] + ': ' + $.getenv(environVar[i]));
}
@moluapple
moluapple / gist:1200180
Created September 7, 2011 09:50
[Illustrator, Scriptographer] Remove Unnecessary PathPoints
// This is a Scriptographer script
document.getItems({
type: Path,
hidden: false
}).each(function (path){
var curves = path.curves, i = curves.length - 1, curve, curvePre;
for (; i > 0; i--){
curve = curves[i];
curvePre = curve.previous;
curve.isLinear() && curvePre.isLinear() &&
@moluapple
moluapple / gist:1200769
Created September 7, 2011 14:50
[Illustrator, Scriptographer] Arrange Objects On Path
// yet another Scriptographer script
var oPath = document.selectedItems[0],
// u = oPath.reverse(),
len = oPath.length,
segments = oPath.segments,
parts = 20,
i = 0;
for (; i <= parts; i++) {
var point = oPath.getLocation(len / parts * i).point,
@moluapple
moluapple / GradientMagic_Sg.js
Created October 25, 2011 03:03
AI 渐变巫术师 Scriptographer 版
script.coordinateSystem = "bottom-up";
var values = {
type: '径向',
opacity: !1,
center: !0,
count: 2,
random: !0,
colormode: '随机',
start: 60,
end: 120,
@moluapple
moluapple / PS_MergeChannelsFromFiles.jsx
Created November 2, 2011 11:48
PS_Merge Multiple Single-Channel-Files to One Multi-Channels File
(function (){
var f = Folder.selectDialog ('选择文件夹'),
fA = f.getFiles ('*.tif'),
fs = f.fsName,
op = new TiffSaveOptions,
i = 0;
op.imageCompression = TIFFEncoding.TIFFLZW; // 设置LZW压缩
for (; i < fA.length; i += 5){
process (fA[i]);
}