Skip to content

Instantly share code, notes, and snippets.

View ff6347's full-sized avatar
🤖
updating status…

Fabian Morón Zirfas ff6347

🤖
updating status…
View GitHub Profile
@ff6347
ff6347 / trycatchexample.jsx
Created May 10, 2012 17:34
catch an error
try{
var no_no = nothing; // nothing does not exist
// so this produces an error
}catch(e){
// open a window and show the alert.
// \n is just a breakline
// \" is to show quotation marks in text
alert("This is the error message \"e\":\n" + e);
}
@ff6347
ff6347 / appSelection.jsx
Created May 10, 2012 17:38
Alert selection in illustrator
app.activeDocument.selection;
@ff6347
ff6347 / createBook.jsx
Created May 11, 2012 14:15
creates a InDesign book from jekyll .md files
// createBook.jsx
// creates a InDesign Book from .md files
// dependencies as follow
// font
// folder called images in jekyll folder
// some find change queries
// https://github.com/fabiantheblind/MT4D-GREP
// place them under:
// /Users/[YOUR USERNAME]/Library/Preferences/Adobe InDesign/Version [NUMBER]/[LOCALIZATION de_DE]/Find-Change Queries/GREP
@ff6347
ff6347 / noObject.c
Created May 11, 2012 16:02
a mini example c program
// include the io lib
#include<stdio.h>
// the compare function takes integer as arguments
int compare(int a, int b){
if(a>b){return a;}else{return b;}
}
// the main function
int main(void){
char name[11] = "Hello World"; // our string
int a = 23,b = 5; // the values to compare
@ff6347
ff6347 / anObject.cpp
Created May 11, 2012 16:05
a simple cpp program
// the string and io classes
#include <iostream>
#include <string>
//using namespace std; // if you use this you can remove all "std::"
class Object{ /* our object*/
public:
std::string name; // its name
@ff6347
ff6347 / anObject.js
Created May 11, 2012 16:06
a simple javascript object example
main(); // call the main function
function main(){ /* here wee go */
var obj = new buildNewObject("Hello JS"); // create a new Object
var a = 23, b = 5; // define the values
obj.compare(a,b); // let the object compare the values
// and make the message
alert("The Script named: "+ obj.name +
"\nCompared: "+ a +" with "+ b +"\n"
@ff6347
ff6347 / rd_MasksToMultipleShapes_doIt.jsx
Created May 16, 2012 19:17
excerpt from rd_MasksToShapes.jsx
// rd_MasksToShapes.jsx
// Copyright (c) 2007 redefinery (Jeffrey R. Almasol). All rights reserved.
// check it: www.redefinery.com
//
// Name: rd_MasksToShapes
// Version: 0.7
//
// Description:
// This script creates a shape layer with paths for each mask on the
// selected layer.
@ff6347
ff6347 / savePower-I.jsx
Created May 24, 2012 19:04
close all InDesign documents with saving
// Like Uncle Ben saz: "With great power comes great responsability!"
app.documents.everyItem().close(SaveOptions.YES);
@ff6347
ff6347 / id_js_helloworld.jsx
Created May 25, 2012 12:08
InDesign JS Hello World
var doc = app.documents.add();
doc.pages.item(0).textFrames.add({
geometricBounds:[13,13,23,50],
contents:"Hello InDesign"});
@ff6347
ff6347 / split shapes to layers.jsx
Created July 1, 2012 17:08
Split The Shapes from one layer to multiple
{
main();
function main(){
app.beginUndoGroup("Split Shape layer");
var curComp = app.project.activeItem;
if (!curComp || !(curComp instanceof CompItem)){
alert("Please select a Composition.");
return;